# HG changeset patch # User bgruening # Date 1752216560 0 # Node ID 158e6ce4834551d22593db9e31675bf75672b08f # Parent dfda27273ead6f64ebb9a7e72b9932dde613f3b1 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 739bcabf09bdb9c291121a6b1f889dabe1a98ea9 diff -r dfda27273ead -r 158e6ce48345 macros.xml --- a/macros.xml Mon Jul 07 06:47:08 2025 +0000 +++ b/macros.xml Fri Jul 11 06:49:20 2025 +0000 @@ -1,6 +1,6 @@ 8.3.0 - 1 + 2 diff -r dfda27273ead -r 158e6ce48345 yolov8.py --- a/yolov8.py Mon Jul 07 06:47:08 2025 +0000 +++ b/yolov8.py Fri Jul 11 06:49:20 2025 +0000 @@ -175,6 +175,15 @@ # # Functions # + +def safe_rmtree(path): + try: + shutil.rmtree(path) + except OSError: + time.sleep(1) + shutil.rmtree(path, ignore_errors=True) + + # Train a new model on the dataset mentioned in yaml file def trainModel(model_path, model_name, yaml_filepath, **kwargs): if "imgsz" in kwargs: @@ -264,7 +273,7 @@ train_save_path = os.path.expanduser('~/runs/' + args.mode + '/train/') if os.path.isdir(train_save_path): - shutil.rmtree(train_save_path) + safe_rmtree(train_save_path) # Load a pretrained YOLO model (recommended for training) if args.model_format == 'pt': model = YOLO(os.path.join(model_path, model_name + "." + args.model_format)) @@ -285,7 +294,7 @@ # Remove prediction save path if already exists val_save_path = os.path.expanduser('~/runs/' + args.mode + '/val/') if os.path.isdir(val_save_path): - shutil.rmtree(val_save_path) + safe_rmtree(val_save_path) # Validate the model metrics = model.val() # no args needed, dataset & settings remembered metrics.box.map # map50-95 @@ -327,7 +336,7 @@ # Remove prediction save path if already exists pred_save_path = os.path.expanduser('~/runs/' + args.mode + '/predict/') if os.path.isdir(pred_save_path): - shutil.rmtree(pred_save_path) + safe_rmtree(pred_save_path) if "foldername" in kwargs: save_folder_name = kwargs['foldername'] # infer on a local image or directory containing images/videos