For my novice, I encountered a lot of problems installing yolov5, so I decided to record him, hoping that future generations can avoid pitfalls.
The first step is to install anaconda
Anaconda | Anaconda Distribution Install the m1 graphical installer in this website.
After the installation is complete, a software icon will not appear like other non-m1 systems.
The second step is to install yolov5
https://github.com/ultralytics/yolov5/tree/v5.0 refer to other tutorials
The third step is to install pycharm
The fourth step is to open the preference in pycharm
The fifth step is to click add interpreter, then select add local interpreter, and then select conda environment,
Change python to 3.9 and click ok, then apply
Then enter it in the terminal of pycharm
pip install -r requirements.txt
pip install opencv-python
pip install opencv-contrib-python
conda uninstall pytorch torchvision torchaudio
pip install torch==1.10.1 torchvision==0.11.2 torchaudio==0.10.1
At this point, clicking Run should generate two pictures under run/detect/exp.
I have been unsuccessful before and jumped out of many mistakes. Finally, I read an article and found that the version of pytorch is too high.