Esempio n. 1
0
 def setup(self, bottom, top):
     self._batch_size = 1
     self._depth = 8
     self._height = 240
     self._width = 320
     self.dataset = jhmdb('train', [self._height, self._width], split=1)
     self.anchors, _, _ = self.dataset.get_anchors()
     self.num_boxes = 64
Esempio n. 2
0
 def __init__(self):
     self._batch_size = 1
     self._depth = 8
     self._height = 240
     self._width = 320
     self.dataset = jhmdb('trainval', [self._height, self._width], split=1)
     self.anchors, self.valid_idx, self._anchor_dims = self.dataset.get_anchors(
     )
Esempio n. 3
0
    def __init__(self, net, model):
        self._batch_size = 1
        self._depth = 8
        self._height = 300
        self._width = 400
        self.dataset = jhmdb('val', [self._height, self._width], split=1)

        caffe.set_mode_gpu()
        self._net = caffe.Net(net, model, caffe.TEST)
 def setup(self, bottom, top):
     self._batch_size = 1
     self._depth = 8
     self._height = 300
     self._width = 400
     self.dataset = jhmdb('val', [self._height, self._width], split=1)
     self.num_classes = self.dataset._num_classes - 1
     self.anchors, self.valid_idx, self._anchor_dims = self.dataset.get_anchors(
     )
Esempio n. 5
0
  def __init__(self, net, model):
    self._batch_size = 1
    self._depth = 8
    self._height = 240
    self._width = 320
    self.dataset = jhmdb('val', [self._height, self._width], split=1)
    self.anchors, self.valid_idx, self._anchor_dims = self.dataset.get_anchors()

    caffe.set_mode_gpu()
    self._net = caffe.Net(net, model, caffe.TEST)
Esempio n. 6
0
    def __init__(self, net, model):
        self._batch_size = 1
        self._depth = 8
        self._height = 240
        self._width = 320
        self.dataset = jhmdb('val', [self._height, self._width],
                             split=1)  #选取测试集,[height, width] = clip_shape
        self.anchors, self.valid_idx, self._anchor_dims = self.dataset.get_anchors(
        )  #获取测试集anchors,valid_idx有效idx

        caffe.set_mode_gpu()
        self._net = caffe.Net(net, model, caffe.TEST)  #网络前传
Esempio n. 7
0
    def __init__(self, net, model):
        self._batch_size = 1
        self._depth = 8
        self._height = 300
        self._width = 400
        self._num_anchors = 10
        self.dataset = jhmdb('train', [self._height, self._width], split=1)
        self.base_anchors = np.load(
            '/data/wjc/thumos14/cache/anchors_{}_{}.npy'.format(
                self._depth, self._num_anchors)).transpose()

        self._bottom_height = np.ceil(self._height / 16.0)
        self._bottom_width = np.ceil(self._width / 16.0)
        self._bottom_width = np.ceil(self._width / 16.0)
        shift_x = np.arange(0, self._bottom_width)
        shift_y = np.arange(0, self._bottom_height)
        shift_x, shift_y = np.meshgrid(shift_x, shift_y)
        shifts = np.vstack((shift_x.ravel(), shift_y.ravel(), shift_x.ravel(),
                            shift_y.ravel())).transpose()
        # add A anchors (1, A, 4) to
        # cell K shifts (K, 1, 4) to get
        # shift anchors (K, A, 4)
        # reshape to (K*A, 4) shifted anchors
        A = self._num_anchors
        K = shifts.shape[0]
        all_anchors = (self.base_anchors.reshape((1, A, 4)) + shifts.reshape(
            (1, K, 4)).transpose((1, 0, 2)))
        all_anchors = all_anchors.reshape((K * A, 4))
        total_anchors = int(K * A)

        # only keep anchors inside the image
        inds_inside = np.where(
            (all_anchors[:, 0] >= 0) & (all_anchors[:, 1] >= 0)
            & (all_anchors[:, 2] < self._bottom_width) &  # width
            (all_anchors[:, 3] < self._bottom_width)  # height
        )[0]

        self.anchors = all_anchors[inds_inside, :]

        caffe.set_mode_gpu()
        self._net = caffe.Net(net, model, caffe.TEST)
        self._list = []
Esempio n. 8
0
from dataset.jhmdb import jhmdb
j = jhmdb(name='train', clip_shape=[240, 320], split=1)
for i in xrange(4, 17):
    j.cluster_bboxes(anchors=i)