Yolo v5 trains its own data set, novice Xiaobai talks nonsense, write to himself

As a freshman, I have a bad memory, and I only use this to record the ordinary life of the first year of research. As long as I don't study, it is still interesting, and I worship the great god every day.

After the instructor arranged for me to use pytorch to train our self-labeled data set, I was making progress. I haven't started school yet, so I took a lot of detours. Later, I went to school early, and then I won't You can shamelessly ask your fellow students! Then you will get guidance from fellow masters hahaha.

feature start

Tip: I searched for a lot of tutorials at the beginning, and then found a very detailed tutorial. There is no need to download one of CUDA and cudnn. The tutorial is here , but our teacher said no (it seems to be unstable during training), so we have to do it alone Downloaded CUDA and cudnn, so I went around and downloaded those two again.

 1. Preparation

1. Buying a computer: The graphics card is from Nvidia, so I can just buy a powerful gaming laptop, or I have a classmate who bought a thin and light laptop, and ask the teacher to equip it with a case. You can use the Sunflower software and call it, each has its own advantages , but I don’t play games myself, and I really hate gaming laptops, so I had to buy gaming laptops so sad.

2. After Xiti’s new computer comes home, open the Nvidia control panel (right click on the desktop)

  Help-----System Information-----Components

Look at the third line, CUDA11.4 or something, top match

Some graphics card configurations are relatively low, you can go to the official website to update the graphics card driver, click here

 Device manager, display adapter depends on your own graphics card model, GeForce -----3060 Laptop, just download it (this is mine)

2. Download all major software

1.Acanconda

After installing this, we will not do it in cmd, just download packages for various environments here, click here for the URL .

This is what I downloaded, and then just install it. When it’s done, it will let you choose. Choose just me. Only I, the current user, can use it. ---next, the installation path is very important, put it on the D drive, and create a folder for him, because all the environments are here

 Well done the next step, this

I'm done. This is someone else's picture. I'll borrow it and use it (invasion and deletion). If it's red, tick it off. Put anac in the environment variable, so you don't have to do it manually.

 It's over, it's over, Anaconda Prompt (Anaconda) only uses this

2.pycharm

This is very simple, you can just click here to enter the official website , download the community, install it on the d drive, and install it by default

3.CUDA

If you don’t know how to find Baidu, Baidu search for cuda official download, or click here , I just tried it and suddenly it can’t be opened, it may be that the school’s campus network is too slow, just choose after opening, don’t get entangled, just 11.0 is fine, because of that It seems that the highest support is 11.2 (2021.09)

As shown in the picture, custom installation, this is someone else's picture, it is different from him, except for Visual Studio, I chose the rest

 

 Similarly, get the d drive and install it.

There is a problem with environment variables here. I haven’t encountered this problem. He has done it himself. There is no need to add it manually. Some bloggers said that it is necessary, right click -----properties------advanced system settings- -----Environment variables-----Double-click path----Add CUDA should be 4. Just add it.

Whether the verification is successful: open anac, enter nvcc -V

 It worked, Oye

4. hidden

This is not difficult, click here , rest assured to register, and then download

Find the CUDNN that supports the CUDA version you have installed, and download it. Unzip the downloaded compressed package, and copy the bin folder, include folder, and lib folder inside to the CUDA installation directory. (Note: There are also these folders in the CUDA installation directory before, and these three files of CUDA should be overwritten)

That's it!

5.pytorch environment

The environment is something like, you install it, and then you feel, ah, it’s finally installed. When you run the code, you will find that the environment is still not installed. If there is less environment, then you continue to install it. 

anaconda (referred to as anac), open him, enter conda list

There is only one base main environment for the new installation. To explain it, you bought a 100-square-meter house base, and you need to divide it into bedrooms, kitchens, study rooms, and toilets.

So we create a house for pytorch

Enter conda create -n pytorch python=3.7

(pytorch is the name given to this room, you can also name something else, mine is pt17, and the latter one is the version number)

Enter, if you are asked y/n, just type y and press Enter

Then it is created, enter conda list again, and you can see the house you built with pytorch

Then activate him, enter conda activate pytorch
to activate and download various annoying environments there.

Well, here comes the hardest part! pytorch download! I vomited! It’s not natural to download from the official website, because the external network is understandable, why Tsinghuayuan’s home use is easy to use, but I can’t use it? Well, don't complain, anyway, there are only three conventional methods

(1) Directly under the external network

After activating your own pytorch environment, copy this

conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge 

Enter, it may succeed, it may become benevolence, needless to say, success, benevolence will appear as follows

 This is a failure, just shut it down and start again. There is a high probability that the network is not good or other reasons I don’t know. It is recommended to try it at night. I downloaded it successfully from the same door, but I did not succeed.

You can also use pip to download: the commands are all done directly on the official website, there is no technical content, and the screenshots are very laborious. If you don’t take screenshots, just do it directly. Enter the pytorch environment, enter the following, and press Enter

pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

It will be over soon, just a little bit, and then there will be a sad red, as follows

The error is probably time out, and the network at home is too bad (I think the network is okay), but it didn't work anyway.

It is suggested to go over the wall directly at this time, it should be successful, but I didn't do it.

(2) mirror image

Click this , find your favorite version hahaha, download it, for example

 Then find out what is the torchvision version corresponding to 1.8.0 (find it on the official website)

 After downloading, put it in Anaconda/envs/pytorch/

Then directly d: to enter the d drive, then use the cd command to enter code (cd /code), then enter anac, go straight, and finally enter pytorch, enter pip install py and press tab to automatically complete the installation package name, press Enter to download. I didn't succeed in this either, I don't know why, I cried.

(3) Copy the installation package directly

(2) No success. Later, the same door said that the three packages of site-packages in the lib folder in the downloaded pytorch will be copied directly to D:\Anaconda\envs\ptg\Lib\site-packages and it will be successful. I Haven't tried it yet, waiting for investigation.

(4) Hang up method

That's right, I just used this method. After downloading from the same door, I copied it directly to me. I'm sorry hahaha, I'm a loser, but it's easy and easy to use directly! If you do not succeed with the above methods and you do not have a good fellow like me, Taobao is omnipotent. Although I didn't succeed, I have experienced and tried all the above methods, and it is enough to bluff people.

At this point, your general environment is almost secure, and there are still some smaller environments that are lacking when running.

This is how I started my postgraduate career. I’m a little trash. Please correct me if I’m wrong.

Guess you like

Origin blog.csdn.net/Zosse/article/details/120541888