Train Classifier on ImageNet (ILSVRC2012) - Sudhakar17/darknet GitHub Wiki
Train Classifier on ImageNet (ILSVRC2012)
Required files:
-
imagenet.labels.list
- labels of objects (classes), filenames of training images should contain these labels, for exampleimg_n02096294.jpg
, example: https://github.com/AlexeyAB/darknet/blob/master/data/imagenet.labels.list -
imagenet.shortnames.list
- names of objects (classes), example: https://github.com/AlexeyAB/darknet/blob/master/data/imagenet.shortnames.list -
imagenet1k.train.list
- paths to Training images -
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- or download
ILSVRC2012_img_train.tar
from Torrent by yourself and then runget_imagenet_train.sh
in the same folder with this tar-file: http://academictorrents.com/browse.php?search=imagenet&page=0
- or download
-
imagenet1k.val.list
- paths to Validation images (for checking accuracy Top1 / Top5) -
Annotated Validation images - you can get these Images and
imagenet1k.val.list
file by using these scripts:- images - 6.3 GB: http://www.image-net.org/challenges/LSVRC/2012/nnoupb/ILSVRC2012_img_val.tar
- annotations - 2.2 MB: http://www.image-net.org/challenges/LSVRC/2012/nnoupb/ILSVRC2012_bbox_val_v3.tgz
- Set validation labels: https://github.com/AlexeyAB/darknet/blob/master/scripts/imagenet_label.sh
- read: https://pjreddie.com/darknet/imagenet/
-
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
csdarknet53-omega.cfg
- network structure: https://github.com/AlexeyAB/darknet/blob/master/cfg/csdarknet53-omega.cfg
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 chartsbackup/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