Train Classifier on ImageNet (ILSVRC2012) - Sudhakar17/darknet GitHub Wiki

Train Classifier on ImageNet (ILSVRC2012)

Required files:

  1. imagenet.labels.list - labels of objects (classes), filenames of training images should contain these labels, for example img_n02096294.jpg, example: https://github.com/AlexeyAB/darknet/blob/master/data/imagenet.labels.list

  2. imagenet.shortnames.list - names of objects (classes), example: https://github.com/AlexeyAB/darknet/blob/master/data/imagenet.shortnames.list

  3. imagenet1k.train.list - paths to Training images

  4. Annotated Training images - you can get these Images and imagenet1k.train.list file by using this script (138 GB) https://github.com/AlexeyAB/darknet/blob/master/scripts/get_imagenet_train.sh

  5. imagenet1k.val.list - paths to Validation images (for checking accuracy Top1 / Top5)

  6. Annotated Validation images - you can get these Images and imagenet1k.val.list file by using these scripts:

  7. imagenet1k.data - file with content:

classes = 1000
train  = data/imagenet1k.train.list
valid  = data/inet.val.list
backup = backup
labels = data/imagenet.labels.list
names  = data/imagenet.shortnames.list
top=5

Look at other models for Classifier: https://pjreddie.com/darknet/imagenet/


Training

  • Training command with accuracy checking (Annotated Validation images are required):

./darknet classifier train cfg/imagenet1k.data cfg/csdarknet53-omega.cfg -topk

  • Training command without accuracy checking:

./darknet classifier train cfg/imagenet1k.data cfg/csdarknet53-omega.cfg

  • Continue training:

./darknet classifier train cfg/imagenet1k.data cfg/csdarknet53-omega.cfg backup/csdarknet53-omega_last.weights -topk

You will get files

  • chart.png with Loss & Top1 charts
  • backup/csdarknet53-omega_last.weights - trained weights file

Classifictation:

Predict:

./darknet classifier predict cfg/imagenet1k.data cfg/csdarknet53-omega.cfg backup/csdarknet53-omega_last.weights dog.jpg

Check accuracy Top1 / Top5:

./darknet classifier valid cfg/imagenet1k.data cfg/csdarknet53-omega.cfg backup/csdarknet53-omega_last.weights