# Reproducing Algorithm Implementation [](https://gitee.com/mindspore/docs/blob/r2.4.0/docs/mindspore/source_en/migration_guide/reproducing_algorithm.md) ## Obtaining Sample Code When you obtain a paper to implement migration on MindSpore, you need to find the reference code that has been implemented in other frameworks. In principle, the reference code must meet at least one of the following requirements: 1. The author opens the paper to the public. 2. The implementation is starred and forked by many developers, which means it is widely recognized. 3. The code is new and maintained by developers. 4. The PyTorch reference code is preferred. If the results are not reproducible in the reference project or the version information is missing, check the project issue for information. If a new paper has no reference implementation, you can refer to [Network Constructing Comparison](https://www.mindspore.cn/docs/en/r2.4.0/migration_guide/model_development/model_development.html). ## Analyzing Algorithm and Network Structure First, when reading the paper and reference code, you need to analyze the network structure to organize the code writing. The following shows the general network structure of YOLOX. | Module| Implementation| | ---- | ---- | | backbone | CSPDarknet (s, m, l, x)| | neck | FPN | | head | Decoupled Head | Second, analyze the innovative points of the migration algorithm and record the tricks used during the training, for example, data augmentation added during data processing, shuffle, optimizer, learning rate attenuation policy, and parameter initialization. You can prepare a checklist and fill in the corresponding items during analysis. For example, the following records some tricks used by the YOLOX network during training.
Trick | Record |
---|---|
Data augmentation | Mosaic, including random scaling, crop, and layout |
MixUp | |
Learning rate attenuation policy | Multiple attenuation modes are available. By default, the COS learning rate attenuation is used. |
Optimizer parameters | SGD momentum=0.9, nesterov=True, and no weight decay |
Training parameters | epoch: 300; batchsize: 8 |
Network structure optimization points | Decoupled Head; Anchor Free; SimOTA |
Training process optimization points | EMA; Data augmentation is not performed for the last 15 epochs; mixed precision |