Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
mynameisyuyanze 78e4d7591f | 1 year ago | |
---|---|---|
partition | 1 year ago | |
scripts | 1 year ago | |
src | 1 year ago | |
README.md | 1 year ago | |
casia_b_config.yaml | 1 year ago | |
eval.py | 1 year ago | |
eval_author.py | 1 year ago | |
p2m.py | 1 year ago | |
preprocess.py | 1 year ago | |
preprocess.sh | 1 year ago | |
requirements.txt | 1 year ago | |
test_model.py | 1 year ago | |
train.py | 1 year ago | |
train_author.py | 1 year ago |
"Darknet53" is a backbone for Yolov3 model.
paper:Joseph Redmon, Ali Farhadi. "YOLOv3: An Incremental Improvement"
The overall network architecture of Net is show below:
Link
Dataset used: ImageNet2012
The mixed precision training method accelerates the deep learning neural network training process by using both the single-precision and half-precision data types, and maintains the network precision achieved by the single-precision training at the same time. Mixed precision training can accelerate the computation process, reduce memory usage, and enable a larger model or batch size to be trained on specific hardware.
For FP16 operators, if the input data type is FP32, the backend of MindSpore will automatically handle it with reduced precision. Users could check the reduced-precision operators by enabling INFO log and then searching ‘reduce precision’.
After installing MindSpore via the official website, you can start training and evaluation as follows:
# distributed training
Usage:
bash run_distribute_train_gpu.sh darknet53 imagenet2012 [DATASET_PATH]
# standalone training
Usage:
bash run_standalone_train_gpu.sh darknet53 imagenet2012 [DATASET_PATH]
# run evaluation example
Usage:
bash run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
.
└──darknet53
├── README.md
├── scripts
├── run_distribute_train_gpu.sh # launch gpu distributed training(8 pcs)
├── run_eval_gpu.sh # launch gpu evaluation
└── run_standalone_train_gpu.sh # launch gpu standalone training(1 pcs)
├── src
├── config.py # parameter configuration
├── CrossEntropySmooth.py # loss definition for ImageNet2012 dataset
├── dataset.py # data preprocessing
├── lr_generator.py # generate learning rate for each step
├── callbacks.py # callbacks for training
└── darknet53.py # darknet53
├── export.py # export model for inference
├── eval.py # eval net
└── train.py # train net
Parameters for both training and evaluation can be set in imagenet_config.yaml
device_target: "GPU"
run_distributed: True
device_num: ""
net: "darknet53"
dataset: "imagenet2012"
dataset_path: ""
pre_trained: ""
class_num: 1000
epoch_num: 150
pretrained_epoch_num: 0
batch_size: 256
momentum: 0.9
loss_scale: 1024
weight_decay: 0.0001
use_label_smooth: True
label_smooth_factor: 0.1
lr: 0.1
lr_scheduler: "cosine_annealing"
eta_min: 0
T_max: 150
warmup_epochs: 5
checkpoint_path: ""
save_checkpoint: True
save_checkpoint_epochs: 5
keep_checkpoint_max: 90
save_checkpoint_path: "./"
summary_dir: "./summary_dir"
You can open http://127.0.0.1:8080 to view trainig process (training loss and validation accuracy). More info you can find in the link MindInsight
# distributed training
Usage:
bash run_distribute_train_gpu.sh darknet53 imagenet2012 [DATASET_PATH]
# standalone training
Usage:
bash run_standalone_train_gpu.sh darknet53 imagenet2012 [DATASET_PATH]
Training result will be stored in the example path, whose folder name begins with "train" or "train_parallel". Under this, you can find checkpoint file together with result like the following in log.
bash run_eval_gpu.sh [DATASET_PATH] [CHECKPOINT_PATH]
result: {'top_5_accuracy': 0.9247195512820513, 'top_1_accuracy': 0.7572916666666667}
python export.py --ckpt_file [CKPT_PATH] --batch_size [BATCH_SIZE] --file_format [FILE_FORMAT]
The ckpt_file parameter is required,
FILE_FORMAT
should be in ["AIR", "MINDIR"]
BATCH_SIZE
current batch_size can only be set to 1.
Parameter | Darknet53 |
---|---|
Resource | GPU: 8xRTX3090 24G; CPU: Intel(R) Xeon(R) Gold 6226R; RAM: 252G |
Upload date | 2021-11-03 |
MindSpore version | 1.3.0 |
Dataset | ImageNet |
Training parameters | imagenet_config.yaml |
Optimizer | Momentum |
Loss function | SoftmaxCrossEntropy |
Output | ckpt file |
Final loss | 1.33 |
Top1 Accuracy | 75.7% |
Total time | 135h |
Parameters (M) | batch_size=256, epoch=150 |
Parameter | Darknet53 |
---|---|
Resource | GPU: 8xRTX3090 24G; CPU: Intel(R) Xeon(R) Gold 6226R; RAM: 252G |
Upload date | 2021-11-03 |
MindSpore version | 1.3.0 |
Dataset | ImageNet |
Batch size | 256(1card) |
Output | Probability |
Accuracy | ACC1[75.7%] ACC5[92.5%] |
Total time | 4m |
In dataset.py, we set the seed inside "create_dataset" function. We also use random seed in train.py.
Please check the official homepage.
No Description
Python Shell
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》