ChenYingpeng / caffe-yolov3

A real-time object detection framework of Yolov3/v4 based on caffe
473 stars 231 forks source link

About input size 608*608 vs 416*416 #22

Open huaze555 opened 5 years ago

huaze555 commented 5 years ago

Hi chen, thank for your pretty work! I hava a problem. If i set the input size is 608608, the result is wrong, and set to 416416 the result seems ok. but the input of yolov3.cfg is 608*608. can you help me?

ChenYingpeng commented 5 years ago

Sorry reply for you so late.I have updated code which support input size 608x608, but you should change some thing.First,you should change input data nxcxhxw=1x3x608x608.Second,you should change yolo_layer.h netWxnetH = 608x608. Good lucky for you.

huaze555 commented 5 years ago

@ChenYingpeng thanks very much!

huaze555 commented 5 years ago

@ChenYingpeng 你好,你的函数接口里,是输入一张图片的路径,然后进行检测。如果我想对一个opencv 的Mat类型图片,进行检测,该怎么做呢?

ChenYingpeng commented 5 years ago

你看看我的源代码其实是用opencv去load的,我记得没错的话是用iplimage的格式,你只要做一下转换就行了!

huaze555 commented 5 years ago

@ChenYingpeng 作者你好,有一个新问题,关于将darknet的weights模型转成caffemodel的。像之前的yolov3.weights能正常转换,但是最新开放的新模型yolov3-spp.weights,转不了,会报错。能提供些思路吗?

ChenYingpeng commented 5 years ago

我看了一下,yolov3-spp.cfg的配置文件,主要是因为spp那个模块里面有个route层里面有4个参数,这个在我的darknet2caffe.py文件里面是不支持的。我只写了支持1或者2个参数的方式,所以你需要按照那个方式自己增加一个支持4个参数的,应该就可以了。不过我自己还没测试,希望你测试玩可以共享一下。

huaze555 commented 5 years ago

@ChenYingpeng 大哥,你能帮忙先补充一下支持4个参数的代码吗? 然后我再测试一下。我对这块代码比较欠缺,不太会搞。拜托啦 ~

huaze555 commented 5 years ago

@ChenYingpeng 依葫芦画瓢,我搞了一天,也没搞出来,,这应该怎么弄呀,大神求帮助 if (4 == bottom_layer_size): prev_layer_id1 = layer_id + int(layer_name[0])

print(prev_layer_id1)

            prev_layer_id2 = layer_id + int(layer_name[1])
            prev_layer_id3 = layer_id + int(layer_name[2])
            prev_layer_id4 = layer_id + int(layer_name[3])
            print(topnames)
            bottom1 = topnames[prev_layer_id1]
            bottom2 = topnames[prev_layer_id2]
            bottom3 = topnames[prev_layer_id3]
            bottom4 = topnames[prev_layer_id4]
            route_layer['bottom'] = [bottom1, bottom2, bottom3, bottom4]
ChenYingpeng commented 5 years ago

@huaze555 Update yolov3_darknet2caffe.py and support yolov3-spp.Good luck!

huaze555 commented 5 years ago

@ChenYingpeng 非常感谢!! 您新提交的代码,除了支持转换spp模型,还支持tiny模型是吗?除了这两个改进,有其它代码层面的优化吗?我现在遇到一个问题,转换后的模型和在darknet跑的模型,对于同一张图片的检测框,有几十个像素值的偏差,框的置信度也会有偏差,不知道问题出在哪里。

onnx20 commented 5 years ago

@huaze555 你好,请问你转caffemodel的脚本用的是作者给的么,我用作者给的遇到一个问题,prototxt能够成功生成,但是在生成caffemodel的时候有个报错: Traceback (most recent call last): File "yolov3_darknet2caffe.py", line 533, in darknet2caffe(cfgfile, weightfile, protofile, caffemodel) File "yolov3_darknet2caffe.py", line 19, in darknet2caffe params = net.params File "/home/oyrq/caffe/python/caffe/pycaffe.py", line 69, in _Net_params self._layer_names, self.layers) File "/home/oyrq/caffe/python/caffe/pycaffe.py", line 70, in if len(lr.blobs) > 0]) OverflowError: cannot fit 'int' into an index-sized integer

我还不知道怎么解决 我也遇到了原模型和转后模型加载到RT工程里时检测框不一样,有时候同一个目标还会出现多个检测框 谢谢!

huaze555 commented 5 years ago

@oyrq 我转yolov3.cfg和yolov3-spp.cfg都没有遇到过你这个问题