|
1 | | -<tool id="yolo_predict" name="Perform YOLO image labeling" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="24.2"> |
| 1 | +<tool id="yolo_predict" name="Perform YOLO image labeling" version="@TOOL_VERSION@+galaxy5" profile="24.2"> |
2 | 2 | <description>with ultralytics</description> |
3 | 3 | <macros> |
4 | 4 | <import>macros.xml</import> |
|
16 | 16 | ln -s '$filename' './input_images/${filename.element_identifier}.${filename.ext}' && |
17 | 17 | #end for |
18 | 18 |
|
19 | | - cp '$class_name' './models/class_name.txt' && |
20 | | -
|
21 | 19 | cp '$model' './models/model.pt' && |
22 | 20 | |
23 | 21 | python '$__tool_directory__/yolov8.py' |
|
29 | 27 | --image_size='$image_size' |
30 | 28 | --mode='$mode' |
31 | 29 | --foldername='overlaid_images' |
32 | | - --class_names_file='$class_name' |
33 | | - --num_classes=`wc -l < ./models/class_name.txt` |
34 | 30 | --confidence='$confidence' |
35 | 31 | --iou='$iou' |
36 | 32 | --max_det='$max_det' |
37 | 33 | --headless |
38 | 34 | ]]> |
39 | 35 | </command> |
40 | 36 | <inputs> |
41 | | - <param name="input_images" type="data" format="jpg,png" multiple="true" label="Input images"/> |
42 | | - <param name="class_name" type="data" format="txt" label="YOLO class name file" /> |
43 | | - <param name="model" type="data" format="data" label="Model file" /> |
44 | | - <param name="mode" type="select" label="Prediction mode"> |
45 | | - <option value="segment">segment</option> |
46 | | - <option value="detect">detect</option> |
47 | | - </param> |
48 | | - <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)." /> |
49 | | - <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." /> |
50 | | - <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." /> |
51 | | - <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." /> |
| 37 | + <param name="input_images" type="data" format="jpg,png,tiff,tif" multiple="true" label="Input images"> |
| 38 | + <validator type="expression" message="PNG/JPG acceptés, TIFF uniquement si 3 canaux (RGB)">value is not None and (value.ext in ('png', 'jpg', 'jpeg') or (value.ext in ('tiff', 'tif') and getattr(value.metadata, 'channels', 0) == 3))</validator> |
| 39 | + </param> |
| 40 | + <param name="model" type="data" format="data" label="Model file" /> |
| 41 | + <param name="mode" type="select" label="Prediction mode"> |
| 42 | + <option value="segment">segment</option> |
| 43 | + <option value="detect">detect</option> |
| 44 | + </param> |
| 45 | + <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)." /> |
| 46 | + <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." /> |
| 47 | + <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." /> |
| 48 | + <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." /> |
52 | 49 | </inputs> |
53 | 50 | <outputs> |
54 | 51 | <collection name="txt_results" format="txt" type="list" label="YOLO bounding box and annotation (text)"> |
|
71 | 68 | <param name="iou" value="0.7" /> |
72 | 69 | <param name="max_det" value="100" /> |
73 | 70 | <param name="mode" value="segment" /> |
74 | | - <param name="class_name" value="class_name.txt" /> |
75 | | - |
76 | 71 | <output_collection name="txt_results" type="list" count="1"> |
77 | 72 | <element name="pred-test01.jpg"> |
78 | 73 | <assert_contents> |
79 | 74 | <has_n_lines n="100"/> |
80 | 75 | </assert_contents> |
81 | 76 | </element> |
82 | 77 | </output_collection> |
83 | | - |
84 | 78 | <output_collection name="mask_results" type="list" count="1"> |
85 | 79 | <element name="pred-test01.jpg"> |
86 | 80 | <assert_contents> |
|
99 | 93 | </assert_contents> |
100 | 94 | </element> |
101 | 95 | </output_collection> |
102 | | - |
103 | 96 | </test> |
104 | | - <!--new version's test--> |
105 | | - <!-- SEGMENT MODE TEST --> |
106 | | - |
107 | 97 | <test expect_num_outputs="3"> |
108 | 98 | <param name="input_images" value="bus.jpg" /> |
109 | | - <param name="class_name" value="yolo-test-classes.txt" /> |
110 | 99 | <param name="model" location="https://github.com/ultralytics/assets/releases/download/v8.3.0/yolov8n-seg.pt" /> |
111 | 100 | <param name="mode" value="segment" /> |
112 | 101 | <param name="image_size" value="640" /> |
|
123 | 112 | <element name="bus.jpg" file="bus_seg.jpg" compare="sim_size" /> |
124 | 113 | </output_collection> |
125 | 114 | </test> |
126 | | - |
127 | | - <!-- DETECT MODE TEST --> |
128 | | - |
129 | 115 | <test expect_num_outputs="2"> |
130 | 116 | <param name="input_images" value="bus.jpg" /> |
131 | | - <param name="class_name" value="yolo-test-classes.txt" /> |
132 | 117 | <param name="model" location="https://github.com/ultralytics/assets/releases/download/v8.3.0/yolov8n-seg.pt" /> |
133 | 118 | <param name="mode" value="detect" /> |
134 | 119 | <param name="image_size" value="640" /> |
|
0 commit comments