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

请问config里面的model.pretrained和model.backbone.pretrained的区别是什么? #3476

Closed
1 task done
MooTong123 opened this issue Aug 28, 2023 · 13 comments
Closed
1 task done
Assignees
Labels
question Further information is requested

Comments

@MooTong123
Copy link

问题确认 Search before asking

  • 我已经搜索过问题,但是没有找到解答。I have searched the question and found no related answer.

请提出你的问题 Please ask your question

请问config里面的model.pretrained和model.backbone.pretrained的区别是什么?我下载了一个预训练模型,是把这个文件地址放到model.pretrained还是model.backbone.pretrained呢?

image

@MooTong123 MooTong123 added the question Further information is requested label Aug 28, 2023
@Asthestarsfalll
Copy link
Contributor

前者属于HRNet_W18,后者属于FCN

@MooTong123
Copy link
Author

MooTong123 commented Aug 29, 2023

前者属于HRNet_W18,后者属于FCN

那比如说其他的模型PP-liteseg,文档里的下载的model是预训练模型?
image

所以说这个下载的model.pdparams,是放到model.pretrained里?所以config是这样?

model:
  type: PPLiteSeg
  backbone:
    type: STDC1
    pretrained: https://bj.bcebos.com/paddleseg/dygraph/PP_STDCNet1.tar.gz
  pretrained: ../pretrained/model.pdparams

还是说下载的这个model,直接放到model.backbone.pretrained里,这样也可以吗?

model:
  type: PPLiteSeg
  backbone:
    type: STDC1
    pretrained: ../pretrained/model.pdparams

@Asthestarsfalll
Copy link
Contributor

@MooTong123
performance下的一般都是训练好的权重,放在外层即可

@MooTong123
Copy link
Author

所以说是得下载两个模型?

model:
  type: PPLiteSeg
  backbone:
    type: STDC1
    pretrained: https://bj.bcebos.com/paddleseg/dygraph/PP_STDCNet1.tar.gz(需下载?)
  pretrained: ../pretrained/model.pdparams(需下载)

还是说直接下载一个performance里面,都放到这两个里面?因为只放到model.pretrained是跑不起来的,model.backbone.pretrained是必须要要有一个模型的。

所以下面这么放是可以的吗?

model:
  type: PPLiteSeg
  backbone:
    type: STDC1
    pretrained:  ../pretrained/model.pdparams
  pretrained: ../pretrained/model.pdparams

@MooTong123
Copy link
Author

MooTong123 commented Aug 30, 2023

还是说performance的model直接放到model.backbone.pretrained里?model.pretrained就不加了?所以哪种形式是正确的?

model:
  type: PPLiteSeg
  backbone:
    type: STDC1
    pretrained:  ../pretrained/model.pdparams

@Asthestarsfalll
Copy link
Contributor

@MooTong123

backbone一般使用预训练权重,用于在下游任务中进行训练
performance中的为训练好的整体权重,加在外层

一般训练使用预训练权重,一般加在内层即可,某些情况下也可以加在外层

infer或eval可以在命令行中传入整体权重地址,无需修改

另外外层权重会覆盖内层权重,只需添加一个即可

@MooTong123
Copy link
Author

@Asthestarsfalll
谢谢解答,还有一个问题,val的时候有class的评价指标,(Class IoU,Class Precision,Class Recall),我该如何知道这个是哪一类的指标?

比如,我是一个人像的分割任务,用labelme进行分割的,然后自动生成了class_names.txt。

_background_
人像

然后我进行训练评估,最后生成的评价指标如下:

{'Images': '4', 'mIoU': '0.5276', 'Acc': '0.7428', 'Kappa': '0.3973', 'Dice': '0.6738', 'Class IoU': '[0.3548 0.7005]', 'Class Precision': '[0.9922 0.7014]', 'Class Recall': '[0.3558 0.9982]'}

比如Class Precision指标,0.9922是指_background_的,还是人像的?这个顺序是根据这个class_names.txt来的吗?但我看源码,没有导入这个class_names.txt这个文件啊,所以这个顺序是怎么确定的?比如有多类的话,那就更分不清了指代的是哪一类了?

@Yana990
Copy link

Yana990 commented Jan 4, 2024

我也想知道这个问题

@Daniel-969
Copy link

@Asthestarsfalll 外层权重覆盖了内层权重,
image
像这种外层的fcn权重已经把hrnet给覆盖了呀,还有必要在内层加载HRNet的权重吗?

@Asthestarsfalll
Copy link
Contributor

@Daniel-969 需要看具体情况,如果FCN_pretrained包含了所有参数的权重,内层就没有必要再加载了;如果FCN_pretrained只包含了一部分内层就需要加载。因此最简单的方式就是内外都加载权重,重复的即会覆盖。

@Daniel-969
Copy link

image
@Asthestarsfalll
1.请问这个ppliteseg网络中miou(filp)是在训练的时候对数据进行水平翻转吗,如果不是,请问具体是什么意思呢?因为我查看vdl里面的精度显示的是miou的精度,如果miou(filp)表示训练的时候水平翻转,那么这个精度好像就对不上了,论文里面也只是miou的值。
2.miou(ms)中的ms是什么意思?那一条说明没看懂,可以详细说明一下吗?
3.下面camvid的配置文件里写的是val.txt,vdl显示的精度也比表格高,请问是因为表格数据是test集,但配置文件和vdl都是val集的原因吗?
image

@Asthestarsfalll
Copy link
Contributor

@Daniel-969

  1. flip指的是测试时翻转,见
  2. ms指将测试图像进行不同比例的放缩,再对miou取均值,见
  3. 应该是的

@Daniel-969
Copy link

@Asthestarsfalll 好的好的,因为只看了网络代码,还没看推理代码所以不是很懂,谢谢解答。还有就是我看代码里面好像是用了三个uafm模块,但论文里面的图上只有两个uafm模块,不知道是不是我代码看错了。见此

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants