コード例 #1
0
ファイル: transformer.py プロジェクト: Royzon/Mxnet-Detector
    def __init__(self,
                 height,
                 width,
                 net=None,
                 mean=[0.485, 0.456, 0.406],
                 std=[0.229, 0.224, 0.225],
                 ignore_threshold=0.5,
                 dynamic=True,
                 from_sigmoid=False,
                 augmentation=False,
                 make_target=False):

        self._height = height
        self._width = width
        self._mean = mean
        self._std = std
        self._augmentation = augmentation
        self._make_target = make_target
        if self._make_target:
            self._output1, self._output2, self._output3, self._anchor1, self._anchor2, self._anchor3, _, _, _, _, _, _ = net(
                mx.nd.zeros((1, 3, height, width)))
            self._target_generator = TargetGenerator(
                ignore_threshold=ignore_threshold,
                dynamic=dynamic,
                from_sigmoid=from_sigmoid)
        else:
            self._target_generator = None
コード例 #2
0
    def __init__(self,
                 height,
                 width,
                 net=None,
                 mean=[0.485, 0.456, 0.406],
                 std=[0.229, 0.224, 0.225],
                 foreground_iou_thresh=0.5,
                 background_iou_thresh=0.4,
                 augmentation=False,
                 make_target=True):

        self._height = height
        self._width = width
        self._mean = mean
        self._std = std
        self._augmentation = augmentation
        self._foreground_iou_thresh = foreground_iou_thresh
        self._background_iou_thresh = background_iou_thresh
        self._make_target = make_target
        if self._make_target:
            _, _, self._anchor = net(mx.nd.zeros((1, 3, height, width)))
            self._target_generator = TargetGenerator(
                foreground_iou_thresh=foreground_iou_thresh,
                background_iou_thresh=background_iou_thresh)
        else:
            self._target_generator = None
コード例 #3
0
 def __init__(self, input_size, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], scale_factor=4,
              make_target=False, num_classes=3):
     self._width = input_size[1]
     self._height = input_size[0]
     self._mean = mean
     self._std = std
     self._scale_factor = scale_factor
     self._make_target = make_target
     if self._make_target:
         self._target_generator = TargetGenerator(num_classes=num_classes)
     else:
         self._target_generator = None
コード例 #4
0
 def __init__(self, input_size, input_frame_number=1, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], scale_factor=4,
              make_target=False, num_classes=3):
     self._width = input_size[1]
     self._height = input_size[0]
     self._mean = torch.as_tensor(mean*input_frame_number).reshape((3*input_frame_number, 1, 1))
     self._std = torch.as_tensor(std*input_frame_number).reshape((3*input_frame_number, 1, 1))
     self._toTensor = torchvision.transforms.ToTensor()
     self._scale_factor = scale_factor
     self._make_target = make_target
     if self._make_target:
         self._target_generator = TargetGenerator(num_classes=num_classes)
     else:
         self._target_generator = None