Using the Model
Predicting the ages of a set of menhaden scale images
Running the Menhaden Ageing Model is straightforward and only requires two commands: one to pre-process the images and a second to run the age inference model. You will, however, need to modify a configurations.yml
file, as described previously. A sample is provided below, while the contents of this file are explained in more detail in the model options.
Activate the Virtual Environment
First we need to activate the virtual environment we previously configured. In a terminal window, type:
conda activate scaleageing
If you named your virtual environment something other than “scaleageing”, invoke that name instead.
Running the model
Navigate (cd
) into the directory containing the predict-ages-multimodal.py
script. If you simply cloned the repo and have not moved anything around, this will in the /scripts
subdirectory in the cloned repository. For example:
cd "c:/Users/user.name/Documents/ageing/FATES-BLH-ScaleAgeing/scripts"
Run the model as described in the usage instructions:
python process-images.py --config_path <config_dir>
python predict-ages-multimodal.py --config_path <config_dir>
where <config_dir>
is the path to the configuration file containing model settings presented above.
Examples
If your configurations.yml
file is stored alongside your model script, your execution commands will simply be:
python process-images.py --config_path configurations.yml
python predict-ages-multimodal.py --config_path configurations.yml
Or, if you named your configuration file something unique such as configuration-2024-atl.yml
, it might look like this:
python process-images.py --config_path configuration-2024-atl.yml
python predict-ages-multimodal.py --config_path configuration-2024-atl.yml
Alternatively, your configurations.yml
file is stored alongside your data, you will need to tell the script exactly where that file is located using its full directory path. Be sure to also include the correct file name, if applicable. For example:
python process-images.py --config_path "c:/Users/user.name/Documents/data/2024/configurations.yml"
python predict-ages-multimodal.py --config_path "c:/Users/user.name/Documents/data/2024/configurations.yml"
If you get a “File not found” error when running the script, carefully check your directories and file names, including those contained in the configuration file.
When finished
When you are finished running the model, deactivate the virtual environment to free up resources on your computer:
conda deactivate
Note that there is no need to specify the environment when deactivating, as conda automatically deactivates the running environment.