Skip to content

Instantly share code, notes, and snippets.

@mjoshi07
Last active August 20, 2024 08:24
Show Gist options
  • Save mjoshi07/8ade1a22434095d5f1072f17db01e158 to your computer and use it in GitHub Desktop.
Save mjoshi07/8ade1a22434095d5f1072f17db01e158 to your computer and use it in GitHub Desktop.
Darknet Commands

train the detector

./darknet detector train 'net.data' 'net.cfg' 'net.conv.14' -map -gpus 1,0
  • if more than one gpu, then select how many/which gpu to use
  • to disable Loss-Window use -dont_show flag
  • to see the mAP & Loss-chart during training on remote server without GUI add -dont_show -mjpeg_port 8090 -map flags then open URL http://ip-address:8090 in browser

run detector on image

darknet.exe detector test cfg/coco.data cfg/yolov3.cfg yolov3.weights -thresh 0.25

run detector on image and show output image

darknet.exe detector test cfg/coco.data yolov3.cfg yolov3.weights -ext_output dog.jpg

run detector on video and show ouput video

darknet.exe detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights -ext_output test.mp4

run detector on video on gpu #1/0

darknet.exe detector demo cfg/coco.data cfg/yolov3-tiny.cfg yolov3-tiny.weights -i 1 test.mp4

run detector on webcam #0

darknet.exe detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights -c 0

save result videofile res.avi

darknet.exe detector demo cfg/coco.data cfg/yolov3.cfg yolov3.weights test.mp4 -out_filename res.avi

calculate anchors Yolov3

darknet.exe detector calc_anchors data/obj.data -num_of_clusters 9 -width 416 -height 416

check accuracy mAP@IoU=75%

darknet.exe detector map data/obj.data yolo-obj.cfg backup\yolo-obj_7000.weights -iou_thresh 0.75

process a list of images data/train.txt and save results of detection to result.json file

darknet.exe detector test cfg/coco.data cfg/yolov3.cfg yolov3.weights -ext_output -dont_show -out result.json < data/train.txt

process a list of images data/train.txt and save results of detection to result.txt

darknet.exe detector test cfg/coco.data cfg/yolov3.cfg yolov3.weights -dont_show -ext_output < data/train.txt > result.txt

Pseudo-lableing - to process a list of images data/new_train.txt and save results of detection in Yolo training format for each image as label <image_name>.txt

darknet.exe detector test cfg/coco.data cfg/yolov3.cfg yolov3.weights -thresh 0.25 -dont_show -save_labels < data/new_train.txt

Get pre-trained weights yolov3-tiny.conv.15

darknet.exe partial cfg/yolov3-tiny.cfg yolov3-tiny.weights yolov3-tiny.conv.15 15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment