Huawei cloud server uses Modlearts to run MindSpore framework Yolov5
Environmental preparation
- Cloud platform login, used to purchase servers https://uconsole.xckpjs.com/
- I am using Ascend 910 here
- Click ModelArts to open the control page, ModelArts
ModelArts is a one-stop development platform for AI developers, providing massive data preprocessing and semi-automatic labeling, large-scale distributed training, automatic model generation, and on-demand deployment of end-edge-cloud models to help users quickly create and deploy Model, manage full-cycle AI workflow.
"One-stop" means that all aspects of AI development, including data processing, algorithm development, model training, and model deployment, can be completed on ModelArts. From a technical point of view, the bottom layer of ModelArts supports various heterogeneous computing resources, and developers can choose to use them flexibly according to their needs without caring about the underlying technology. At the same time, ModelArts supports mainstream open source AI development frameworks such as Tensorflow, PyTorch, and MindSpore, and also supports developers to use self-developed algorithm frameworks to match your usage habits.
The idea of ModelArts is to make AI development easier and more convenient.
Provides a convenient and easy-to-use process for AI developers with different experiences. For example, for business developers, you don’t need to pay attention to models or codes, and can use the automatic learning process to quickly build AI applications; for AI beginners, you don’t need to pay attention to model development, and use preset algorithms to build AI applications; for AI engineers, you can provide a variety of Development environment, multiple operating processes and modes, convenient for developers to code and expand, and quickly build models and applications.
- Click the Object Storage Console, this is the only tool for transferring files with the server.
Select the required version to download the client and
create a new bucket after logging in. The bucket is a container for storing code and data. For the convenience of management, it is recommended that each project has a bucket. ModelArts controllers are synchronous
Code download and upload
Yolov5 link of MindSpore framework https://www.hiascend.cn/zh/software/modelzoo/models/detail/C/9af06eedaa1b9577d6221a939a31747d
Click to download the model script, which is the code file
and then copy the file modelart
in the folder train_start.py
to the code folder on the upper layer, which is the startup file for ModelArts training
Now we upload the code to the bucket, open the previously downloaded OBS Browser+ client, create a new bucket, the name can be customized, and then create four new folders, namely
code
, used to store running codedataset
, used to store data setslog
, used to store log filesoutput
, used to store the output file
and then upload the yolov5 code downloaded in the previous step to the code folder, and put the dataset into the dataset folder. The dataset I use here is coco2014
ModelArts creation algorithm
Open the ModelArts console, click Algorithm Management, and then click Create Algorithm to create our own algorithm
The name can be customized, the AI engine is selected MindSpore
, the code directory is selected in the code folder in the bucket, and the startup file is selected code
in the folder just copiedtrain_start.py
Add code path parameters to input data data_url
Add code path parameters to output data Add hyperparameters train_url
, max_epoch
the default value is 1
Click Submit in the lower right corner to create the algorithm successfully
ModelArts training data
Click the training job in ModelArts, and then click Create training job
Select the algorithm created in the previous step
Select the dataset path in the OBS bucket for training input and select the folder
in the OBS bucket for training outputoutput
Hyperparameter max_epoch
is to choose how many times to iterate and input according to your own needs
For the resource pool below, select the server you purchased, and select the log folder in the OBS bucket for the job date and path
Click Submit in the lower right corner to start training. Depending on the number of iterations and the size of the data set, the training time varies. The
training may report an error NameError: name 'args' is not defined
NameError: name 'args' is not defined
My solution is to open the error file train_start.py
and find that args is indeed not defined in it, just add a definition.
After running successfully, you can click to enter the training task to view parameters such as loss value,
or you can enter the log folder in the OBS bucket to view log files
If you have any questions, welcome to comment, if you find it helpful, please like and collect it!