Skip to content

Commit

Permalink
model definition update
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Jun 9, 2020
1 parent 715cb08 commit 5bee686
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ def _make_grid(nx=20, ny=20):


class Model(nn.Module):
def __init__(self, model_yaml='yolov5s.yaml'): # cfg, number of classes, depth-width gains
def __init__(self, model_yaml='yolov5s.yaml', ch=3, nc=None): # model, input channels, number of classes
super(Model, self).__init__()
with open(model_yaml) as f:
self.md = yaml.load(f, Loader=yaml.FullLoader) # model dict
if nc:
self.md['nc'] = nc # override yaml value

# Define model
self.model, self.save, ch = parse_model(self.md, ch=[3]) # model, savelist, ch_out
self.model, self.save, ch = parse_model(self.md, ch=[ch]) # model, savelist, ch_out
# print([x.shape for x in self.forward(torch.zeros(1, 3, 64, 64))])

# Build strides, anchors
Expand Down

0 comments on commit 5bee686

Please sign in to comment.