Python version 3.7.9 was used for this
https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html
Also, this is only if your machine has an Nvidia gpu. If it prompts you that no version of vsCode is found and that you won’t have full functionality without it, make sure you download vsCode and try to reinstall with it finding vsCode.
https://pytorch.org/get-started/locally/
The “start locally” command is important after you've installed Cuda.
You’ll want to confirm that cuda and pytorch are connected. Run something like the code below in python:
import torch
torch.cuda.is_available()
This should return true. Also once you create your DEEPLABCUT environment you should run it again inside to confirm.
https://imagemagick.org/index.php
Only needed if you want to batch convert .tif files to .png, I find this useful when doing analysis of TEM image crops using the imageJ macro Michael N. made https://github.com/MNeuhoff/Crop-and-Collage-Tools
https://deeplabcut.github.io/DeepLabCut/docs/installation.html
I used the conda installation process, specifically step 2 is the important one, where you download the yaml file and create the virtual environment.
https://www.bulkrenameutility.co.uk/Download.php This is to rename files in bulk, which can be handy if we are creating a large training set with files that might have the same name at first.
First, let's make a folder of our training data. Both sections below (ImageMagick and Bulk Rename Utility) might be useful for this
- Create a folder with all of your .tif files
- Inside this folder, create another folder called “png_files”.
- In a windows terminal, navigate to the folder containing the .tif files and the other folder
- Run the command: for %f in (*.tif) do magick "%f" "png_files%~nf.png"
- You will see that “png_files” contains your converted png files, which will work in deeplabcut
- Launch Bulk Rename Utility, just search it on the windows bar. There will be a lot going on but only a few things are relevant for what we want to do.
- Navigate to the folder with the images you want to rename.
- On the tab “Name (2)”, select “Fixed” for the dropdown “Name”, and below enter your filename.
- On the tab “Numbering (10)”, select “Suffix” for “Mode”
- On the tab “Numbering (10)”, change padding such that each of your files can get a unique file name (ie. for <=100 files, padding is 3, for >100 and <=1000 padding is 4, etc.)
- Select all files in your folder you want to rename (ctrl+A to select all)
- Press “Rename” at the bottom right and press OK.
- Your files should now be renamed with an appropriate suffix.
Now you're ready to begin using the code!
- Create a new folder in which you want to contain your projects.
- Download all
.ipynbfiles and paste them into the folder. - If you're starting a new project, begin with
deeplabcut_project_creation_and_training.ipynband follow the instructions in the notebook
If they didn't open automatically, open your config as a file and your folder of interest as a folder. You should then have 1 layer of collected data and one layer of images.
To label, select the collected data layer, and under layer controls at the very top you can select whether you want to create, delete, or move points. On the right you should be able to see your bodyparts you selected. You can also change your point size, and checking the display text checkbox will write the name of your bodyparts over their respective points, which can be useful for double checking things. You can also use the right and left arrows to change between images, which helps when labeling a lot of data. When you are done labeling, press ctrl+s while the collected data layer is selected, then a .csv and .h5 file should be created in the directory of the data you were labeling.
- Try running the check if cuda is available in your DEEPLABCUT environment as well
- When you are training the network, check your gpu in task manager, and see if its memory is being used.
