Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

大佬想问一下您的代码细节问题 #5

Closed
gongpx20069 opened this issue Nov 3, 2019 · 9 comments
Closed

大佬想问一下您的代码细节问题 #5

gongpx20069 opened this issue Nov 3, 2019 · 9 comments

Comments

@gongpx20069
Copy link

您的YOLOLayer类里的forward函数里的targets的大小是什么呢?能给个比较详细的解释吗?我想用VOC数据集来训练,也是第一次接触YOLO,拜托了

@liux0614
Copy link
Owner

liux0614 commented Nov 4, 2019

targets 包括: idx, class_id, x, y, h, w (yolo format)
idx用于把bounding boxes和image对应起来,是个最小为0,最大为batch size大小的整数

@gongpx20069
Copy link
Author

也就是说,这里的class_id, x, y, h, w都是int
您比如说batchsize=1,这个时候,targets的size就是(1,1,4)吗?

@liux0614
Copy link
Owner

liux0614 commented Nov 4, 2019

不是 只有idx 和 class_id 是 int (但是在实际计算里的时候是这两个整数会被转化成float的,e.g. 1 -> 1.0)
targets的size应该是2d的: batch size x 6

Edit: the target size should be (total # of bounding boxes in a batch) x 6

@gongpx20069
Copy link
Author

大佬,假如说是(batch_size, 6)的大小的话,假如一张图的bbox有多个呢?这不就没办法表示了吗?

@liux0614
Copy link
Owner

liux0614 commented Nov 4, 2019

不好意思 我说错了 target size应该是 一个batch里面bounding box总数 x 6
然后idx用来标识每个bounding box该属于哪张图片, class_id标识这个bounding box属于哪类, x y h w是yolo格式的坐标

@gongpx20069
Copy link
Author

大佬,我代码看得有点晕,这个idx是指该图片矩阵在batch中的位置吧?比如第一张的话idx=0;第二张idx=1这样?

@liux0614
Copy link
Owner

liux0614 commented Nov 5, 2019

对的
比如你有三张图片,第一张图片有3个bbox,第二张有4个,第三张有5个,
那么你的targets就会有12个,前三个bbox的idx为0(对应第一张图片),之后的四个bbox的idx为1(对应第二张图片,最后5个bbox的idx为2(对应第三张图片

@gongpx20069
Copy link
Author

稳了大佬,我大概都看懂了

@liux0614
Copy link
Owner

liux0614 commented Nov 6, 2019

优秀

@liux0614 liux0614 closed this as completed Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants