yolo-v2只识别person
一.修改源代码
(1)修改cfg/voc.data
classess=20 改成 classes = 1
(2)修改data/voc.names
只留下person这一类
(3)修改examples/detector.c
1 void run_detector(int argc, char **argv)//该函数中,倒数第三行.line=542 2 int classes = option_find_int(options, "classes", 1);//最后一个参数修改成1 3 4 void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh)函数中 5 draw_detections(im, l.w*l.h*l.n, thresh, boxes, probs, names, alphabet, 1); //最后一个参数修改成1。line=481
二.重新编译和测试
(1)重新编译
make clean
make
(2)测试
./darknet detect cfg/yolo.cfg yolo.weights /home/260158/pictures-data/mark-pic/video1/images/491.jpg
上面为我的图片路径