Closed Bergylta closed 9 months ago
The issue is here:
img_size=(img_h.value, img_w.value)
Changing this to img_size=img_h.value should solve the problem. I will fix this on my side as well.
New issue in the same location
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
Cell In[13], line 1
----> 1 mlp.train_yolov5(
2 exp_name.value,
3 weights.artifact_path,
4 project,
5 epochs=epochs.value,
6 batch_size=batch_size.value,
7 img_size=(img_h.value),
8 )
File /usr/src/app/kso-dev/kso_utils/project.py:1255, in MLProjectProcessor.train_yolov5(self, exp_name, weights, project, epochs, batch_size, img_size)
1251 def train_yolov5(
1252 self, exp_name, weights, project, epochs=50, batch_size=16, img_size=[640, 640]
1253 ):
1254 if self.model_type == 1:
-> 1255 self.modules["train"].run(
1256 entity=self.team_name,
1257 data=self.data_path,
1258 hyp=self.hyp_path,
1259 weights=weights,
1260 project=project,
1261 name=exp_name,
1262 imgsz=img_size,
1263 batch_size=int(batch_size),
1264 epochs=epochs,
1265 single_cls=False,
1266 cache_images=True,
1267 upload_dataset=True,
1268 )
1269 elif self.model_type == 2:
1270 self.modules["train"].run(
1271 entity=self.team_name,
1272 data=self.data_path,
(...)
1278 epochs=epochs,
1279 )
File /usr/src/app/kso/yolov5/train.py:627, in run(**kwargs)
625 for k, v in kwargs.items():
626 setattr(opt, k, v)
--> 627 main(opt)
628 return opt
File /usr/src/app/kso/yolov5/train.py:527, in main(opt, callbacks)
525 # Train
526 if not opt.evolve:
--> 527 train(opt.hyp, opt, device, callbacks)
529 # Evolve hyperparameters (optional)
530 else:
531 # Hyperparameter evolution metadata (mutation scale 0-1, lower_limit, upper_limit)
532 meta = {
533 'lr0': (1, 1e-5, 1e-1), # initial learning rate (SGD=1E-2, Adam=1E-3)
534 'lrf': (1, 0.01, 1.0), # final OneCycleLR learning rate (lr0 * lrf)
(...)
560 'mixup': (1, 0.0, 1.0), # image mixup (probability)
561 'copy_paste': (1, 0.0, 1.0)} # segment copy-paste (probability)
File /usr/src/app/kso/yolov5/train.py:414, in train(hyp, opt, device, callbacks)
408 if f is best:
409 LOGGER.info(f'\nValidating {f}...')
410 results, _, _ = validate.run(
411 data_dict,
412 batch_size=batch_size // WORLD_SIZE * 2,
413 imgsz=imgsz,
--> 414 model=attempt_load(f, device).half(),
415 iou_thres=0.65 if is_coco else 0.60, # best pycocotools at iou 0.65
416 single_cls=single_cls,
417 dataloader=val_loader,
418 save_dir=save_dir,
419 save_json=is_coco,
420 verbose=True,
421 plots=plots,
422 callbacks=callbacks,
423 compute_loss=compute_loss) # val best model with plots
424 if is_coco:
425 callbacks.run('on_fit_epoch_end', list(mloss) + list(results) + lr, epoch, best_fitness, fi)
File /usr/src/app/kso/yolov5/models/experimental.py:79, in attempt_load(weights, device, inplace, fuse)
77 model = Ensemble()
78 for w in weights if isinstance(weights, list) else [weights]:
---> 79 ckpt = torch.load(attempt_download(w), map_location='cpu') # load
80 ckpt = (ckpt.get('ema') or ckpt['model']).to(device).float() # FP32 model
82 # Model compatibility updates
File /usr/local/lib/python3.8/dist-packages/torch/serialization.py:791, in load(f, map_location, pickle_module, weights_only, **pickle_load_args)
788 if 'encoding' not in pickle_load_args.keys():
789 pickle_load_args['encoding'] = 'utf-8'
--> 791 with _open_file_like(f, 'rb') as opened_file:
792 if _is_zipfile(opened_file):
793 # The zipfile reader is going to advance the current file position.
794 # If we want to actually tail call to torch.jit.load, we need to
795 # reset back to the original position.
796 orig_position = opened_file.tell()
File /usr/local/lib/python3.8/dist-packages/torch/serialization.py:271, in _open_file_like(name_or_buffer, mode)
269 def _open_file_like(name_or_buffer, mode):
270 if _is_path(name_or_buffer):
--> 271 return _open_file(name_or_buffer, mode)
272 else:
273 if 'w' in mode:
File /usr/local/lib/python3.8/dist-packages/torch/serialization.py:252, in _open_file.__init__(self, name, mode)
251 def __init__(self, name, mode):
--> 252 super().__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'Project(Project_name=Koster_Seafloor_Obs, Zooniverse_number=9747, db_path=/tmp/db/koster_lab.db, server=SNIC, bucket=None, key=None, csv_folder=/mimer/NOBACKUP/groups/snic2021-6-9/db_starter/csv_Koster_Seafloor_Obs/, movie_folder=/mimer/NOBACKUP/groups/snic2021-6-9/project_movies/movies_Koster/, photo_folder=None, ml_folder=None)/KSO_rough_cushion_5_80_emil/weights/best.pt'
----> 1 mlp.train_yolov5( 2 exp_name.value, 3 weights.artifact_path, 4 project.Project_name, 5 epochs=epochs.value, 6 batch_size=batch_size.value, 7 img_size=(img_h.value), 8 )
š Bug
To Reproduce (REQUIRED)
Model type: Object detection model Select model: baseline-yolo5 Batch size: 8, Epoch: 80, H/W: 128x128 Input:
Output:
Expected behavior
Additional context