Skip to content

πŸ“· | DarkNet19, DarkNet53, DarkNet53-ELASTIC and CSPDarkNet53 Implementation using PyTorch

Notifications You must be signed in to change notification settings

yakhyo/darknet-pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

59 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Implementation of DarkNet19, DarkNet53, CSPDarkNet53 with PyTorch

Table of Contents

Project Description

  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:

Installation

 git clone https://github.com/yakhyo/darknet-pytorch.git
 cd darknet-pytorch
 python main.py path/to/imagenet --batch-size 512 --workers 8

Continue from checkpoint:

python main.py path/to/imagenet --batch-size 512 --workers 8 --resume darknet53.pth.tar

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

  • GPU: Tesla V100
  • Input size: 3x224x224

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}

Usage

from model 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)

Contributing

If you find any issues within this code, feel free to create PR or issue.

License

The project is licensed under the MIT license.

Releases

No releases published

Packages

No packages published

Languages