This is a good starting point:
For the environment I use anaconda and follow the pytorch install instructions:
Check your OS and Conda and CUDA (if you don't have CUDA then I would get a card before you bother training), and do what it says.
Then do:
git clone https://github.com/ultralytics/yolov5.git
followed by:
cd yolov5
pip install -r requirements.txt
Once you have a dataset put them in the correct directory structure and modify data.yaml to point to the directories and start training:
python train.py --img 256 --batch -1 --epochs 500 --data data.yaml --weights yolov5n.pt --save-period 100 --patience 100 --name yolov5-nn --cache --multi-scale