Mercurial > repos > bgruening > yolo_predict
diff yolo_prediction.xml @ 0:13c24d4d6da0 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools commit 67e0e1d123bcfffb10bab8cc04ae67259caec557
| author | bgruening |
|---|---|
| date | Fri, 13 Jun 2025 11:23:57 +0000 |
| parents | |
| children | c5003f152e3e |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/yolo_prediction.xml Fri Jun 13 11:23:57 2025 +0000 @@ -0,0 +1,133 @@ +<tool id="yolo_predict" name="Perform YOLO image labeling" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2"> + <description>with ultralytics</description> + <macros> + <import>macros.xml</import> + </macros> + <expand macro="creator" /> + <expand macro="edam" /> + <expand macro="requirements" /> + <command detect_errors="aggressive"> + <![CDATA[ + export YOLO_CONFIG_DIR='\$HOME/.config/ultralytics' && + + mkdir -p ./input_images ./runs ./models ./results && + + #for $filename in $input_images: + ln -s '$filename' './input_images/${filename.element_identifier}' && + #end for + + cp '$class_name' './models/class_name.txt' && + + cp '$model' './models/model.pt' && + + python '$__tool_directory__/yolov8.py' + --test_path='./input_images' + --model_path='./models' + --model_name='model' + --run_dir='./runs' + --save_dir='./results' + --image_size='$image_size' + --mode='$mode' + --foldername='overlaid_images' + --class_names_file='$class_name' + --num_classes=`wc -l < ./models/class_name.txt` + --confidence='$confidence' + --iou='$iou' + --max_det='$max_det' + + ]]> + </command> + <inputs> + <param name="input_images" type="data" format="jpg,png" multiple="true" label="Input images"/> + <param name="class_name" type="data" format="txt" label="YOLO class name file" /> + <param name="model" type="data" format="data" label="Model file" /> + <param name="mode" type="select" label="Prediction mode"> + <option value="segment">segment</option> + <option value="detect">detect</option> + </param> + <param name="image_size" type="integer" value="1000" min="16" label="Image size" help="All input images will be re-sized to squares with sides of this length (in pixels). This value governs the trade-offs of speed (smaller values) vs accuracy (larger values)." /> + <param name="confidence" type="float" value="0.5" min="0.0" max="1.0" label="Confidence" help="Confidence value (0-1) for each detected bounding box." /> + <param name="iou" type="float" value="0.7" min="0.1" max="1.0" label="IoU" help="Intersection over Union threshold for non-maximum suppression." /> + <param name="max_det" type="integer" value="300" min="100" max="1000" label="Max. number of detections" help="Maximum number of detections allowed per image. Limits the total number of objects the model can detect in a single inference, preventing excessive outputs in dense scenes." /> + </inputs> + <outputs> + <collection name="txt_results" format="txt" type="list" label="YOLO prediction results (text)"> + <discover_datasets pattern="(?P<name>.*)\.txt$" directory="results" visible="true"/> + </collection> + <collection name="mask_results" format="tiff" type="list" label="YOLO prediction masks"> + <discover_datasets pattern="(?P<name>.*)\.tiff$" directory="results" visible="true"/> + </collection> + + </outputs> + <tests> + <test> + <param name="input_images" value="pred-test01.jpg" /> + <param name="model" location="https://zenodo.org/records/15611468/files/best.pt" /> + <param name="image_size" value="512" /> + <param name="confidence" value="0.003" /> + <param name="iou" value="0.7" /> + <param name="max_det" value="100" /> + <param name="mode" value="segment" /> + <param name="class_name" value="class_name.txt" /> + <output_collection name="txt_results" type="list" count="1"> + <element name="pred-test01"> + <assert_contents> + <has_n_lines n="100"/> + </assert_contents> + </element> + </output_collection> + + <output_collection name="mask_results" type="list" count="1"> + <element name="pred-test01_mask"> + <assert_contents> + <has_image_width width="512"/> + <has_image_height height="1024"/> + <has_image_channels channels="1"/> + </assert_contents> + </element> + </output_collection> + </test> + <test> + <param name="input_images" value="pred-test01.png" /> + <param name="model" location="https://zenodo.org/records/15611468/files/best.pt" /> + <param name="image_size" value="512" /> + <param name="confidence" value="0.003" /> + <param name="iou" value="0.7" /> + <param name="max_det" value="100" /> + <param name="mode" value="segment" /> + <param name="class_name" value="class_name.txt" /> + <output_collection name="txt_results" type="list" count="1"> + <element name="pred-test01"> + <assert_contents> + <has_n_lines n="100"/> + </assert_contents> + </element> + </output_collection> + <output_collection name="mask_results" type="list" count="1"> + <element name="pred-test01_mask"> + <assert_contents> + <has_image_width width="512"/> + <has_image_height height="1024"/> + <has_image_channels channels="1"/> + </assert_contents> + </element> + </output_collection> + </test> + </tests> + <help><![CDATA[ + **What it does** + This tool performs predictions on input images using yolo compatible model. It supports two modes of operation: segment, detect. + + **Outputs:** + + - **Coordinates TXT File** (`.txt`) + - A plain text file containing predictions for each detected object. + + OR + - **Segmentation Mask** (`.tiff`) + - An image mask where each pixel value represents a class label. + + ]]> + </help> + <expand macro="citations" /> +</tool>
