This project currently uses HRNet to perform segmentation on x-ray images of bones. However, better results are anticipated with HRFormer. The backbone of HRFormer is being added to the project to test and train with our data to yeild better results under some metrics like AP, AR, acc, #params, and FLOPs. Torch.nn is a significant external class used in the realization of this project. config.net will be the location of where models are defined and will have information defining a loss function. If the loss function is defined in config.net, the Backbone constructor will call loss_selector which has its call stack returning to fit.py. Otherwise, an error is returned.
- Install Anaconda package manager with Python version 3.9 from Miniconda (recommended because of small size) or full Anaconda (includes graphical user interface for package management).
- Verify that the pip3 (Python 3's official package manager) is installed by entering
pip3 -v
in the terminal. If it is not installed, install it, perhaps using this tutorial. - Create the conda environment
jtml
from theenvironment.yml
using the commandconda env create -f environment.yml
. Alternatively, use the win_modcuda_environment.yml or win_environment.yml to create the environment with windows. - Activate the conda env with
conda activate jtml
. - There may be other dependencies that you can install using conda or pip3.
WandB - our logging system.
- Create an account from the website and send the email you used to Sasank (to get invited to the Wandb team).
- WandB is used because it effectively visualizes and logs our test and training runs of a model.
- GPU Power, Memory, and Temp information is visualized. A train/loss graph is displayed with a validation output at specified step sizes.
If you have an NVIDIA graphics card, please install CUDA. This will allow you to use your GPU for training, which is useful when running a couple batches during development to ensure the code runs.
Large data is in the Files section of the Microsoft Teams team. Please copy these files/folders locally. This includes the image folder of X-ray images and segmentation masks (you need to unzip this folder) and the .ckpt model checkpoint file needed for loading a pretrained model for testing.
After you download these files/folders locally, remember to edit the config file (in config/config.py) to specify the location of your local image directory and checkpoint file.
- Be in the Bone-Meal directory (use the
cd
command to change the directory to theblah/blah/Bone-Meal/
directory).- Work within the anaconda prompt with your active environment.
- To fit (train) a model, call
python scripts/fit.py my_config
wheremy_config
is the name of the config.py file in theconfig/
directory.- The config file should specify the model, data, and other parameters.
- Initially, the project is set to run a small number of epochs. This can be modified in config.py
- You will know know fitting your model worked if you view text that indicates a "success" for your run and the WandB logs function. WandB will indicate the state of running your model and whether it ran successfully or failed.
- Source Code: https://github.com/BRIO-lab/Bone-Meal/