yolo-v2修改只识别person

一.修改源代码

cfg/coco.data

classes= 1     #修改成1
train  = /home/pjreddie/data/coco/trainvalno5k.txt
valid  = coco_testdev
#valid = data/coco_val_5k.list
names = data/coco.names
backup = /home/pjreddie/backup/
eval=coco

src/detector.c

void run_detector(int argc, char **argv)//该函数中,倒数第三行.line=542
int classes = option_find_int(options, "classes", 1);//最后一个参数修改成1

void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh)函数中
draw_detections(im, l.w*l.h*l.n, thresh, boxes, probs, names, alphabet, 1); //最后一个参数修改成1。line=481

二.重新编译和测试

1.重新编译

make clean
make

2.测试

./darknet detector demo cfg/coco.data cfg/yolo.cfg yolo.weights 

你可能感兴趣的:(YOLO实时检测)