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 scaleageingIf you named your virtual environment something other than “scaleageing”, invoke that name instead.
Running the model
Navigate (cd) into the directory containing the Scale_Aging_Inference_Script_Multimodal.py script. If you simply cloned the repo and have not moved anything around, this will in the /Menhaden Scales Aging/Inference Script subdirectory in the cloned repository. For example:
cd "c:/Users/user.name/Documents/ageing/FATES-BLH-OtolithAgeing/Menhaden Scales Aging/Inference Script"Run the model as described in the usage instructions:
python Scale_Raw_Image_Preprocessing.py --config_path <config_dir>
python Scale_Aging_Inference_Script_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 Scale_Raw_Image_Preprocessing.py --config_path configurations.yml
python Scale_Aging_Inference_Script_Multimodal.py --config_path configurations.ymlOr, if you named your configuration file something unique such as configuration-2024-atl.yml, it might look like this:
python Scale_Raw_Image_Preprocessing.py --config_path configuration-2024-atl.yml
python Scale_Aging_Inference_Script_Multimodal.py --config_path configuration-2024-atl.ymlAlternatively, 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 Scale_Raw_Image_Preprocessing.py --config_path "c:/Users/user.name/Documents/data/2024/configurations.yml"
python Scale_Aging_Inference_Script_Image_Only.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 deactivateNote that there is no need to specify the environment when deactivating, as conda automatically deactivates the running environment.