Skip to the content.

Implementation of DarkNet19, DarkNet53, CSPDarkNet53 on PyTorch

Contents:

  1. DarkNet19 - used as a feature extractor in YOLO900.
  2. DarkNet53 - used as a feature extractor in YOLOv3.
  3. CSPDarkNet53 - Implementation of Cross Stage Partial Networks in DarkNet53.
  4. DarkNet53-Elastic - Implementation of ELASTIC with DarkNet53.
  5. CSPDarkNet53-Elastic - Implementation of CSP and ELASTIC in DarkNet53.??

Architecture of DarkNet19 and DarkNet53:

Description:

Results:

This Repo. Official
Model Acc@1 Acc@5 Params Acc@1 Acc@5
DarkNet19 70.5 89.7 21M 74.1 91.8
DarkNet53 75.6 92.5 41M 77.2 93.8
CSP-DarkNet53 74.3 92.2 19M 77.2 93.6
DarkNet53-Elastic 70.8 90.2 24M ... ...
CSPDarkNet53-Elastic ... ... ... 76.1 93.3

Weights of DarkNet53 (105th epoch), DarkNet19 (50th epoch), CSPDarkNet53 (80th epoch) and DarkNet53 ELASTIC (57th epoch) are available on here.

Trained on ImageNet

Dataset structure:

├── IMAGENET 
    ├── train
         ├── [class_id1]/xxx.{jpg,png,jpeg}
         ├── [class_id2]/xxy.{jpg,png,jpeg}
         ├── [class_id3]/xxz.{jpg,png,jpeg}
          ....
    ├── val
         ├── [class_id1]/xxx1.{jpg,png,jpeg}
         ├── [class_id2]/xxy2.{jpg,png,jpeg}
         ├── [class_id3]/xxz3.{jpg,png,jpeg}

Train:

 git clone https://github.com/yakhyo/DarkNet.git
 cd DarkNet2
 python main.py ../IMAGENET --batch-size 512 --workers 8

Note

Modify this line to choose the network to start the training:

from nets.nn import darknet19, darknet53, darknet53e, cspdarknet53

# darknet19
model = darknet19(num_classes=1000, init_weight=True)

# darknet53
model = darknet53(num_classes=1000, init_weight=True)

# darknet53 elastic
model = darknet53e(num_classes=1000, init_weight=True)

# cspdarknet53
model = cspdarknet53(num_classes=1000, init_weight=True)

Continue the training:

python main.py ../../Dataset/IMAGENET --batch-size 512 --workers 8 --resume darknet53.pth.tar