Skip to content

Error in creating model with Ghost modules #2081

Description

@alrzmshy

🐛 Bug

Hello, I'm trying to build the yolov5s models with Ghost modules but I run into an issue. I replaced C3 with GhostBottleneck in the yaml file and added GhostBottleneck in the list of modules that are expected in yolo.py file and as I try to construct the model, I get this error:

To Reproduce

Output:

TypeError                                 Traceback (most recent call last)
<ipython-input-2-7facafecdabb> in <module>()
----> 1 model = Model("./models/yolov5s.yaml")
      2 

<ipython-input-1-7b447b7ed90c> in __init__(self, cfg, ch, nc)
     78             logger.info('Overriding model.yaml nc=%g with nc=%g' % (self.yaml['nc'], nc))
     79             self.yaml['nc'] = nc  # override yaml value
---> 80         self.model, self.save = parse_model(deepcopy(self.yaml), ch=[ch])  # model, savelist
     81         self.names = [str(i) for i in range(self.yaml['nc'])]  # default names
     82         # print([x.shape for x in self.forward(torch.zeros(1, ch, 64, 64))])

<ipython-input-1-7b447b7ed90c> in parse_model(d, ch)
    252 
    253         print(m, args)
--> 254         m_ = nn.Sequential(*[m(*args) for _ in range(n)]) if n > 1 else m(*args)  # module
    255         t = str(m)[8:-2].replace('__main__.', '')  # module type
    256         np = sum([x.numel() for x in m_.parameters()])  # number params

TypeError: __init__() missing 1 required positional argument: 's'

Additional context

Here is my models folder that contains the modifications:

models.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions