# HG changeset patch # User bgruening # Date 1752216629 0 # Node ID 2e6ca212a1af9404951f9c66bdf0f5fb557b5f9a # Parent 96269d5d31cc4b1607bb0c5a9762c9623776ed6e planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 739bcabf09bdb9c291121a6b1f889dabe1a98ea9 diff -r 96269d5d31cc -r 2e6ca212a1af macros.xml --- a/macros.xml Mon Jul 07 06:48:11 2025 +0000 +++ b/macros.xml Fri Jul 11 06:50:29 2025 +0000 @@ -1,6 +1,6 @@ 8.3.0 - 1 + 2 diff -r 96269d5d31cc -r 2e6ca212a1af yolov8.py --- a/yolov8.py Mon Jul 07 06:48:11 2025 +0000 +++ b/yolov8.py Fri Jul 11 06:50:29 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