Giter VIP home page Giter VIP logo

Comments (10)

i4yyds avatar i4yyds commented on May 27, 2024

您好,我尝试将输入尺寸从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.

Hongzhehao avatar Hongzhehao commented on May 27, 2024

@SoulCoderCN 目前看来应该是需要手动调整的,只是我还没有找到相关联的地方在哪里

from retinanet-pytorch.

i4yyds avatar i4yyds commented on May 27, 2024

@SoulCoderCN 目前看来应该是需要手动调整的,只是我还没有找到相关联的地方在哪里

好像不需要手动调整,我刚刚用这个代码成功跑了VOC2007,而VOC2007中的图片尺寸并不是统一的。
目前训练自己的数据集还是不行,不知道出了什么问题。

from retinanet-pytorch.

Hongzhehao avatar Hongzhehao commented on May 27, 2024

@SoulCoderCN 请问下你的显存是多少呀,我之前运行的时候,600尺度的图片 一直是 cuda out of memory

from retinanet-pytorch.

i4yyds avatar i4yyds commented on May 27, 2024

@SoulCoderCN 请问下你的显存是多少呀,我之前运行的时候,600尺度的图片 一直是 cuda out of memory

在config.py文件中设置 _C.TRAIN.BATCH_SIZE = 1,就不会溢出了

from retinanet-pytorch.

yatengLG avatar yatengLG commented on May 27, 2024

@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.

i4yyds avatar i4yyds commented on May 27, 2024

@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.

yatengLG avatar yatengLG commented on May 27, 2024

谢谢提供这个模型,由于我修改了FPN的结构,在训练的时候(8G的显存),输入尺寸为600时,总是出现CUDA out of memory,我想减小到输入尺寸为300,特征图(5层)应该变成 38、19、10、5、3,那么对应的预测框大小该如何设置?

如果只是改变了输入尺寸的话,可以直接了当的 都/2。因为输入图片小了,目标尺寸也相应的缩小了同样的倍数。

from retinanet-pytorch.

yatengLG avatar yatengLG commented on May 27, 2024

@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.

ZhanJunxiang avatar ZhanJunxiang commented on May 27, 2024

谢谢提供这个模型,由于我修改了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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.