Add suffix checks (#4711)
* Add suffix checks * Cleanup * Cleanup2 * Cleanup3
This commit is contained in:
1 parent
8e5f9ddbdb
commit
a2b3c71636
7 files changed
+41
-21
No files matched your search
@@ -22,8 +22,9 @@ sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
||||
|
||||
from models.experimental import attempt_load
|
||||
from utils.datasets import create_dataloader
|
||||
from utils.general import coco80_to_coco91_class, check_dataset, check_file, check_img_size, check_requirements, \
|
||||
box_iou, non_max_suppression, scale_coords, xyxy2xywh, xywh2xyxy, set_logging, increment_path, colorstr
|
||||
from utils.general import coco80_to_coco91_class, check_dataset, check_img_size, check_requirements, \
|
||||
check_suffix, check_yaml, box_iou, non_max_suppression, scale_coords, xyxy2xywh, xywh2xyxy, set_logging, \
|
||||
increment_path, colorstr
|
||||
from utils.metrics import ap_per_class, ConfusionMatrix
|
||||
from utils.plots import plot_images, output_to_target, plot_study_txt
|
||||
from utils.torch_utils import select_device, time_sync
|
||||
@@ -116,6 +117,7 @@ def run(data,
|
||||
(save_dir / 'labels' if save_txt else save_dir).mkdir(parents=True, exist_ok=True) # make dir
|
||||
|
||||
# Load model
|
||||
check_suffix(weights, '.pt')
|
||||
model = attempt_load(weights, map_location=device) # load FP32 model
|
||||
gs = max(int(model.stride.max()), 32) # grid size (max stride)
|
||||
imgsz = check_img_size(imgsz, s=gs) # check image size
|
||||
@@ -316,7 +318,7 @@ def parse_opt():
|
||||
opt = parser.parse_args()
|
||||
opt.save_json |= opt.data.endswith('coco.yaml')
|
||||
opt.save_txt |= opt.save_hybrid
|
||||
opt.data = check_file(opt.data) # check file
|
||||
opt.data = check_yaml(opt.data) # check YAML
|
||||
return opt
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user