Mercurial > repos > bgruening > json2yolosegment
changeset 2:158e6ce48345 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 739bcabf09bdb9c291121a6b1f889dabe1a98ea9
author | bgruening |
---|---|
date | Fri, 11 Jul 2025 06:49:20 +0000 |
parents | dfda27273ead |
children | 97bc82ee2a61 |
files | macros.xml yolov8.py |
diffstat | 2 files changed, 13 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ <macros> <token name="@TOOL_VERSION@">8.3.0</token> - <token name="@VERSION_SUFFIX@">1</token> + <token name="@VERSION_SUFFIX@">2</token> <xml name="creator"> <creator> <person name="Yi Sun" email="sunyi000@gmail.com" />
--- 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