In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
In this article, the editor introduces "how to build the Yolov5 server environment" in detail, the content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to build the Yolov5 server environment" can help you solve your doubts.
1 server build yolov5 environment 1.1 create environment
First of all, build our environment in the local environment, and the name is yolo5-6.
Conda create-n yolov5-6 python=3.7# create environment conda activate yolov5-switch yolov5-6 environment
After creating the package, we need to check whether there is the environment we just created in the conda environment, and we can view all the environments through the following instructions.
Conda env list
You can view the cuda version of the server by using the following instructions.
Conda env list
1.2 follow official guidelines
According to the official Quick start, YOLOv5 documents (ultralytics.com), we need to clone the repository at first. But this will be slow, because the server is easily disconnected from the github, so we can download and extract the library in advance, and then upload it to the server.
Upload files
For scholars who connect to the server, many people like to use Xshell, but in fact, finalshell is more suitable for transferring files to the server. So downloading finalshell makes it easy to upload files.
Generally speaking, the downloaded file should have this name.
When we upload to the server, we need to go to cd and navigate to the yolov5-master folder and check through ls to see if there is a requirements.txt file. If not, whether visual or non-visual, you must locate the cd to the folder that contains the file.
Officially, we will install the required packages from the cloned repository directory. However, if you use a foreign pip, the download speed will be outrageous, so we use Tsinghua Garden to download.
Pip install-I https://pypi.tuna.tsinghua.edu.cn/simple-r requirements.txt-r requirements.txtLooking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Download complete.
Use the following instructions to see if the packages that yolo needs to run have been installed.
Pip list
Obviously, it's already installed.
2 download pre-training weight
Generally, in order to shorten the training time of the network and achieve better accuracy, we generally load the pre-training weight for network training. Version 5.0 of yolov5 provides us with several pre-training weights, and we can choose different versions of pre-training weights according to our different needs. The greater the weight of pre-training, the higher the accuracy of the training, but the slower the detection speed will be.
Click the link below to download the pre-training model. Pull it to the bottom.
GitHub-ultralytics/yolov5 at v6.1
It is important to note that when you perform the previous steps, you actually have your own yolov5s weight file (.pt) and some other model configuration files (.yaml).
It should be noted that, large, does not mean that you can run, if you are a laboratory level, then you are welcome to download the best, but if it is a school server, then 5s is believed to be enough for you to use [although the speed is the fastest, the effect is the most hip-pulling], because you need to fully consider the graphics memory of the graphics card when running the model.
3 reasoning
Next we need to download the model of yolov5. There is no way to speed up in this step, so we have to wait.
Arbitrarily create a new .py file, and then write the following code to run on the terminal.
Import torch# Modelmodel = torch.hub.load ('ultralytics/yolov5',' yolov5s') # or yolov5m, yolov5l, yolov5x, custom# Imagesimg = 'https://ultralytics.com/images/zidane.jpg' # or file, Path, PIL, OpenCV, numpy, list# Inferenceresults = model (img) # Resultsresults.print () # or .show (), .save (), .save (), .pandas (), etc.
Pass the file to the server through finalshell, and then start it using the instruction.
Python Test02.py
4 Test
-source represents test data,-project specifies the save path, and-weights specifies the test model. Let's use the official test files in the yolov5master folder to test whether the yolov5s model is available.
Enter the following instructions in the shell command window:
Python detect.py-source data/images/zidane.jpg-weights v5_pre_models/yolov5s.pt-project out-img-size 640This article "how to build a Yolov5 server environment" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it before you can understand it. If you want to know more about related articles, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.