Comments (10)
您好,我尝试将输入尺寸从600修改为800,然后计算loss的代码报错
loss[pos_mask] = -math.inf # 无穷
IndexError: The shape of the mask [1, 67995] at index 1 does not match the shape of the indexed tensor [1, 120087] at index 1
请问如何解决呢?
from retinanet-pytorch.
@SoulCoderCN 目前看来应该是需要手动调整的,只是我还没有找到相关联的地方在哪里
from retinanet-pytorch.
@SoulCoderCN 目前看来应该是需要手动调整的,只是我还没有找到相关联的地方在哪里
好像不需要手动调整,我刚刚用这个代码成功跑了VOC2007,而VOC2007中的图片尺寸并不是统一的。
目前训练自己的数据集还是不行,不知道出了什么问题。
from retinanet-pytorch.
@SoulCoderCN 请问下你的显存是多少呀,我之前运行的时候,600尺度的图片 一直是 cuda out of memory
from retinanet-pytorch.
@SoulCoderCN 请问下你的显存是多少呀,我之前运行的时候,600尺度的图片 一直是 cuda out of memory
在config.py文件中设置 _C.TRAIN.BATCH_SIZE = 1,就不会溢出了
from retinanet-pytorch.
@SoulCoderCN 输入大小改变,会导致特征图大小发生改变,你需要对 fpn的输入特征图大小进行更改,也就是_C.MODEL.ANCHORS.FEATURE_MAPS 项, 其值为 第一项为 IMAGE_SIZE/ (2**3)向上取整,其后每项均/2 向上取整;你的报错 IndexError: The shape of the mask [1, 67995] at index 1 does not match the shape of the indexed tensor [1, 120087] at index 1 是因为,特征图大小发生改变,导致最终输出发生改变:原先(75^2+38^2+19^2+10^2+5^2x9 = 67995, 改为800后: (100^2+50^2+25^2+13^2+7^2x9 = 120087 俩者完全不匹配了
from retinanet-pytorch.
@SoulCoderCN 输入大小改变,会导致特征图大小发生改变,你需要对 fpn的输入特征图大小进行更改,也就是_C.MODEL.ANCHORS.FEATURE_MAPS 项, 其值为 第一项为 IMAGE_SIZE/ (2**3)向上取整,其后每项均/2 向上取整;你的报错 IndexError: The shape of the mask [1, 67995] at index 1 does not match the shape of the indexed tensor [1, 120087] at index 1 是因为,特征图大小发生改变,导致最终输出发生改变:原先(75^2+38^2+19^2+10^2+5^2x9 = 67995, 改为800后: (100^2+50^2+25^2+13^2+7^2x9 = 120087 俩者完全不匹配了
@yatengLG 感谢您的回复,我使用您的方法成功解决了这个问题!
from retinanet-pytorch.
谢谢提供这个模型,由于我修改了FPN的结构,在训练的时候(8G的显存),输入尺寸为600时,总是出现CUDA out of memory,我想减小到输入尺寸为300,特征图(5层)应该变成 38、19、10、5、3,那么对应的预测框大小该如何设置?
如果只是改变了输入尺寸的话,可以直接了当的 都/2。因为输入图片小了,目标尺寸也相应的缩小了同样的倍数。
from retinanet-pytorch.
@SoulCoderCN 输入大小改变,会导致特征图大小发生改变,你需要对 fpn的输入特征图大小进行更改,也就是_C.MODEL.ANCHORS.FEATURE_MAPS 项, 其值为 第一项为 IMAGE_SIZE/ (2**3)向上取整,其后每项均/2 向上取整;你的报错 IndexError: The shape of the mask [1, 67995] at index 1 does not match the shape of the indexed tensor [1, 120087] at index 1 是因为,特征图大小发生改变,导致最终输出发生改变:原先(75^2+38^2+19^2+10^2+5^2x9 = 67995, 改为800后: (100^2+50^2+25^2+13^2+7^2x9 = 120087 俩者完全不匹配了
@yatengLG 感谢您的回复,我使用您的方法成功解决了这个问题!
@SoulCoderCN 这个项目由于不是论文复现,很多地方会有我自己代码的习惯,因此与原论文会有些许的差异。如果遇到什么问题,你可以继续问我
from retinanet-pytorch.
谢谢提供这个模型,由于我修改了FPN的结构,在训练的时候(8G的显存),输入尺寸为600时,总是出现CUDA out of memory,我想减小到输入尺寸为300,特征图(5层)应该变成 38、19、10、5、3,那么对应的预测框大小该如何设置?
如果只是改变了输入尺寸的话,可以直接了当的 都/2。因为输入图片小了,目标尺寸也相应的缩小了同样的倍数。
您好,你说的检测框尺寸/2,那就是将anchor_sizes都/2吗?像这样调整将图片尺寸/2,除了调整feature_map和anchor_size外,还有需要调整的吗?需不需要调整anchor.nums或anchor.radios?
from retinanet-pytorch.
Related Issues (20)
- boxes 矩阵运算报错 IndexError: too many indices for array
- BUG! 当图片(.xml)中不包含任何 object 时! HOT 1
- 网络如何进行微调和迁移学习 HOT 4
- 如何分别设置输入图片IMAGE_SIZE的长宽? HOT 1
- 迭代次数 HOT 1
- 你好,我用自己的数据集,跑了一夜,loss很低,但是测试结果特别差,能给一些建议吗
- 我训练的数据集,目标比较小,训练的时候loss很低,但是检测不出来,ap值三点几 HOT 3
- 为什么会出现这个错误RuntimeError: Expected object of scalar type float but got scalar type double for argument 'other' HOT 14
- 我计算ap的时候很高有0.83但是检测单张图片为啥没有结果,只有几个框,iou设置为了0.5 HOT 2
- 欢迎大家star、fork
- false positives 特别多的问题 HOT 2
- 报错 HOT 2
- RunTimeError HOT 7
- RuntimeError: Found dtype Double but expected Float HOT 1
- 方便把fpn 的 p6, p7 加回来吗? HOT 1
- fpn最后的3X3卷积都是用的conv1的吗? HOT 2
- VOC数据集的最终mAP HOT 1
- visdom server 網頁無法開啟
- ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (6,) + inhomogeneous part.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from retinanet-pytorch.