Bobo-y / flexible-yolov5

More readable and flexible yolov5 with more backbone(gcn, resnet, shufflenet, moblienet, efficientnet, hrnet, swin-transformer, etc) and (cbam,dcn and so on), and tensorrt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于模型搭建和初始化权重时的若干问题

danchaofan-git opened this issue · comments

  1. 在config文件夹里面,除data.yaml和超参数的yaml文件外,均存在一个问题:
    PAN:
    channel_out: [256, 512, 512, 1024]
    应该修改为:
    PAN:
    channel_outs: [256, 512, 512, 1024]
    否则会出现"TypeError: init() got an unexpected keyword argument 'channel_out'"的错误;
  2. 当我使用resnet_model.yaml时,若令cbam = True,则会报"TypeError: max_pool1d(): argument 'kernel_size' (position 2) must be tuple of ints, not Tensor"错误,请问我需要修改什么内容,使其能正常运行?
  3. 当我想使用预训练权重,比如官方提供的"yolov5s.pt"时,出现"ModuleNotFoundError: No module named 'models'"错误,我发现这个代码库的文件目录与原作者的不太一样,如何修改代码,使得预训练权重正常导入?
commented

@danchaofan-git 第一个问题已更新,第三个问题,由于目录结构更改所以无法直接加载。如果想要加载可以参考这个 #96 ,我目前没有去实现加载原作者的权重,不好意思。第二个问题,我run一下代码

commented

@danchaofan-git 第二个问题已经更新代码了,很奇怪,当输入shape 是 [1, c, h, w] 时, x.shape 就是 tensor(1),tensor(c),tensor(h),tensor(w), 当第一个维度不是1时,直接就是int类型。但我以前也没遇到这种情况

Ok,感谢!我再试一下~