Пример #1
0
    def __init__(self, cfgfile, use_giou_loss):
        super(Darknet, self).__init__()
        self.use_giou_loss = use_giou_loss
        self.blocks = parse_cfg(cfgfile)
        self.width = int(self.blocks[0]['width'])
        self.height = int(self.blocks[0]['height'])

        self.models = self.create_network(self.blocks)  # merge conv, bn,leaky
        self.yolo_layers = [
            layer for layer in self.models
            if layer.__class__.__name__ == 'YoloLayer'
        ]

        self.loss = self.models[len(self.models) - 1]

        self.header = torch.IntTensor([0, 0, 0, 0])
        self.seen = 0
    def __init__(self, cfgfile):
        super(Darknet, self).__init__()
        self.blocks = parse_cfg(cfgfile)
        self.width = int(self.blocks[0]['width'])
        self.height = int(self.blocks[0]['height'])

        self.models = self.create_network(self.blocks)  # merge conv, bn,leaky
        self.yolo_layers = [layer for layer in self.models if hasattr(layer, "metrics")]

        self.loss = self.models[len(self.models) - 1]

        if self.blocks[(len(self.blocks) - 1)]['type'] == 'region':
            self.anchors = self.loss.anchors
            self.num_anchors = self.loss.num_anchors
            self.anchor_step = self.loss.anchor_step
            self.num_classes = self.loss.num_classes

        self.header = torch.IntTensor([0, 0, 0, 0])
        self.seen = 0
Пример #3
0
    def __init__(self, cfgfile, use_giou_loss):
        super(YOLO_only, self).__init__()
        self.use_giou_loss = use_giou_loss
        dict_blocks = parse_cfg(cfgfile)
        self.blocks = nn.ModuleList()
        for block in dict_blocks:
            self.blocks.append(DictWrapper(block))

        #self.blocks = nn.ModuleList(parse_cfg(cfgfile))
        self.width = int(self.blocks[0]['width'])
        self.height = int(self.blocks[0]['height'])

        self.models = self.create_network(self.blocks)  # merge conv, bn,leaky
        self.yolo_layers = [
            layer for layer in self.models
            if layer.__class__.__name__ == 'YoloLayer'
        ]

        self.loss = self.models[len(self.models) - 1]

        self.header = torch.IntTensor([0, 0, 0, 0])
        self.seen = 0