comparison image_learner.xml @ 2:186424a7eca7 draft

planemo upload for repository https://github.com/goeckslab/gleam.git commit 91fa4aba245520fc0680088a07cead66bcfd4ed2
author goeckslab
date Thu, 03 Jul 2025 20:43:24 +0000
parents 39202fe5cf97
children 2c3a3dfaf1a9
comparison
equal deleted inserted replaced
1:39202fe5cf97 2:186424a7eca7
42 --learning-rate "$learning_rate" 42 --learning-rate "$learning_rate"
43 #end if 43 #end if
44 #if $batch_size_define == "true" 44 #if $batch_size_define == "true"
45 --batch-size "$batch_size" 45 --batch-size "$batch_size"
46 #end if 46 #end if
47 --split-probabilities "$train_split" "$val_split" "$test_split" 47 --split-probabilities "$train_split" "$val_split" "$test_split"
48 #end if 48 #end if
49 --random-seed "$random_seed" 49 #if $augmentation
50 --augmentation "$augmentation"
51 #end if
52 --random-seed "$random_seed"
50 --output-dir "." && 53 --output-dir "." &&
51 54
52 mkdir -p '$output_model.extra_files_path' && 55 mkdir -p '$output_model.extra_files_path' &&
53 cp -r experiment_run/model/*.json experiment_run/model/model_weights '$output_model.extra_files_path' && 56 cp -r experiment_run/model/*.json experiment_run/model/model_weights '$output_model.extra_files_path' &&
54 57
55 echo "Image Learner Classification Experiment is Done!" 58 echo "Image Learner Classification Experiment is Done!"
56 ]]> 59 ]]>
57 </command> 60 </command>
58 61
59 <inputs> 62 <inputs>
60 <param argument="input_csv" type="data" format="csv" optional="false" label="the metadata csv containing image_path column, label column and optional split column" /> 63 <param argument="input_csv" type="data" format="csv" optional="false" label="the metadata csv containing image_path column, label column and optional split column" />
61 <param name="image_zip" type="data" format="zip" optional="false" label="Image zip" help="Image zip file containing your image data"/> 64 <param name="image_zip" type="data" format="zip" optional="false" label="Image zip" help="Image zip file containing your image data"/>
62 <param name="model_name" type="select" optional="false" label="Select a model for your experiment" > 65 <param name="model_name" type="select" optional="false" label="Select a model for your experiment" >
63 66
64 <option value="resnet18">Resnet18</option> 67 <option value="resnet18">Resnet18</option>
65 <option value="resnet34">Resnet34</option> 68 <option value="resnet34">Resnet34</option>
66 <option value="resnet50">Resnet50</option> 69 <option value="resnet50">Resnet50</option>
67 <option value="resnet101">Resnet101</option> 70 <option value="resnet101">Resnet101</option>
68 <option value="resnet152">Resnet152</option> 71 <option value="resnet152">Resnet152</option>
138 </param> 141 </param>
139 142
140 <conditional name="scratch_fine_tune"> 143 <conditional name="scratch_fine_tune">
141 <param name="use_pretrained" type="select" 144 <param name="use_pretrained" type="select"
142 label="Use pretrained weights?" 145 label="Use pretrained weights?"
143 help="If select no, the encoder, combiner, and decoder will all be initialized and trained from scratch. 146 help="If select no, the encoder, combiner, and decoder will all be initialized and trained from scratch. (e.g. when your images are very different from ImageNet or no suitable pretrained model exists.)">
144 (e.g. when your images are very different from ImageNet or no suitable pretrained model exists.)">
145 <option value="false">No</option> 147 <option value="false">No</option>
146 <option value="true" selected="true">Yes</option> 148 <option value="true" selected="true">Yes</option>
147 </param> 149 </param>
148 <when value="true"> 150 <when value="true">
149 <param name="fine_tune" type="select" label="Fine tune the encoder?" 151 <param name="fine_tune" type="select" label="Fine tune the encoder?"
154 </when> 156 </when>
155 <when value="false"> 157 <when value="false">
156 <!-- No additional parameters to show if the user selects 'No' --> 158 <!-- No additional parameters to show if the user selects 'No' -->
157 </when> 159 </when>
158 </conditional> 160 </conditional>
161 <param argument="augmentation"
162 name="augmentation"
163 type="select"
164 multiple="true"
165 display="checkboxes"
166 label="Image Augmentation"
167 help="Pick any combination of augmentations to apply">
168 <option value="random_horizontal_flip">Random Horizontal Flip</option>
169 <option value="random_vertical_flip">Random Vertical Flip</option>
170 <option value="random_rotate">Random Rotate</option>
171 <option value="random_blur">Random Blur</option>
172 <option value="random_brightness">Random Brightness</option>
173 <option value="random_contrast">Random Contrast</option>
174 </param>
159 <param argument="random_seed" type="integer" value="42" optional="true" label="Random seed (set for reproducibility)" min="0" max="999999"/> 175 <param argument="random_seed" type="integer" value="42" optional="true" label="Random seed (set for reproducibility)" min="0" max="999999"/>
160 <conditional name="advanced_settings"> 176 <conditional name="advanced_settings">
161 <param name="customize_defaults" type="select" label="Customize Default Settings?" help="Select yes if you want to customize the default settings of the experiment."> 177 <param name="customize_defaults" type="select" label="Customize Default Settings?" help="Select yes if you want to customize the default settings of the experiment.">
162 <option value="false" selected="true">No</option> 178 <option value="false" selected="true">No</option>
163 <option value="true">Yes</option> 179 <option value="true">Yes</option>
203 help="Fraction of data for testing (e.g., 0.2) train split + val split + test split should = 1."/> 219 help="Fraction of data for testing (e.g., 0.2) train split + val split + test split should = 1."/>
204 </when> 220 </when>
205 <when value="false"> 221 <when value="false">
206 <!-- No additional parameters to show if the user selects 'No' --> 222 <!-- No additional parameters to show if the user selects 'No' -->
207 </when> 223 </when>
208 </conditional> 224 </conditional>
209 </inputs> 225 </inputs>
210 <outputs> 226 <outputs>
211 <data format="ludwig_model" name="output_model" label="${tool.name} trained model on ${on_string}" /> 227 <data format="ludwig_model" name="output_model" label="${tool.name} trained model on ${on_string}" />
212 <data format="html" name="output_report" from_work_dir="image_classification_results_report.html" label="${tool.name} report on ${on_string}" /> 228 <data format="html" name="output_report" from_work_dir="image_classification_results_report.html" label="${tool.name} report on ${on_string}" />
213 <collection type="list" name="output_pred_csv" label="${tool.name} predictions CSVs/experiment stats/plots on ${on_string}" > 229 <collection type="list" name="output_pred_csv" label="${tool.name} predictions CSVs/experiment stats/plots on ${on_string}" >
214 <discover_datasets pattern="(?P&lt;designation&gt;predictions\.csv)" format="csv" directory="experiment_run" /> 230 <discover_datasets pattern="(?P&lt;designation&gt;predictions\.csv)" format="csv" directory="experiment_run" />
236 <has_n_columns n="1" /> 252 <has_n_columns n="1" />
237 </assert_contents> 253 </assert_contents>
238 </element> 254 </element>
239 </output_collection> 255 </output_collection>
240 </test> 256 </test>
257 <test expect_num_outputs="3">
258 <param name="input_csv" value="mnist_subset.csv" ftype="csv" />
259 <param name="image_zip" value="mnist_subset.zip" ftype="zip" />
260 <param name="model_name" value="resnet18" />
261 <param name="augmentation" value="random_horizontal_flip,random_vertical_flip,random_rotate" />
262 <output name="output_report">
263 <assert_contents>
264 <has_text text="Results Summary" />
265 <has_text text="Train/Validation Results" />
266 <has_text text="Test Results" />
267 </assert_contents>
268 </output>
269
270 <output_collection name="output_pred_csv" type="list" >
271 <element name="predictions.csv" >
272 <assert_contents>
273 <has_n_columns n="1" />
274 </assert_contents>
275 </element>
276 </output_collection>
277 </test>
278 <test expect_num_outputs="3">
279 <param name="input_csv" value="utkface_labels.csv" ftype="csv" />
280 <param name="image_zip" value="age_regression.zip" ftype="zip" />
281 <param name="model_name" value="resnet18" />
282 <output name="output_report">
283 <assert_contents>
284 <has_text text="Results Summary" />
285 <has_text text="Train/Validation Results" />
286 <has_text text="Test Results" />
287 </assert_contents>
288 </output>
289 <output name="output_report" file="expected_regression.html" compare="sim_size"/>
290
291 <output_collection name="output_pred_csv" type="list" >
292 <element name="predictions.csv" >
293 <assert_contents>
294 <has_n_columns n="1" />
295 </assert_contents>
296 </element>
297 </output_collection>
298 </test>
241 </tests> 299 </tests>
242 <help> 300 <help>
243 <![CDATA[ 301 <![CDATA[
244 **What it does** 302 **What it does**
245 Image Learner for Classification: trains and evaluates a image classification model. 303 Image Learner for Classification: trains and evaluates a image classification model.
246 It uses the metadata csv to find the image paths and labels. 304 It uses the metadata csv to find the image paths and labels.
247 The metadata csv should contain a column with the name 'image_path' and a column with the name 'label'. 305 The metadata csv should contain a column with the name 'image_path' and a column with the name 'label'.
248 Optionally, you can also add a column with the name 'split' to specify which split each row belongs to (train, val, test). 306 Optionally, you can also add a column with the name 'split' to specify which split each row belongs to (train, val, test).
249 If you do not provide a split column, the tool will automatically split the data into train, val, and test sets based on the proportions you specify or [0.7, 0.1, 0.2] by default. 307 If you do not provide a split column, the tool will automatically split the data into train, val, and test sets based on the proportions you specify or [0.7, 0.1, 0.2] by default.
308
309 **If the selected label column has more than 10 unique values, the tool will automatically treat the task as a regression problem and apply appropriate metrics (e.g., MSE, RMSE, R²).**
250 310
251 311
252 **Outputs** 312 **Outputs**
253 The tool will output a trained model in the form of a ludwig_model file, 313 The tool will output a trained model in the form of a ludwig_model file,
254 a report in the form of an HTML file, and a collection of CSV/json/png files containing the predictions, experiment stats and visualizations. 314 a report in the form of an HTML file, and a collection of CSV/json/png files containing the predictions, experiment stats and visualizations.