示例#1
0
    def get_next_minibatch(self):
        """Return the blobs to be used for the next minibatch. Thread safe."""
        valid = False
        while not valid:
            db_inds = self._get_next_minibatch_inds()
            minibatch_db = [self._roidb[i] for i in db_inds]
            blobs, valid = get_minibatch(minibatch_db)

            # img = np.asarray([blobs['data'][0][2], blobs['data'][0][1], blobs['data'][0][0]]).astype('uint8')[0]
            # matrix = blobs['im_tr_matrix']
            # scale = blobs['im_info'][0][2]
            # for gt_roi in minibatch_db[0]['boxes']:
            #     w, h = gt_roi[2] - gt_roi[0], gt_roi[3] - gt_roi[1]
            #     nw, nh = int(w * scale), int(h * scale)
            #     center_x, center_y = gt_roi[0] + w / 2, gt_roi[1] + h / 2
            #     new_center = np.dot(matrix, [[center_x], [center_y], [1.0]]).astype('int')
            #     new_center_x = int(new_center[0][0])
            #     new_center_y = int(new_center[1][0])
            #     nbx = int(new_center_x - nw / 2)
            #     nby = int(new_center_y - nh / 2)
            #     nbx2 = int(nbx + nw)
            #     nby2 = int(nby + nh)
            #     cv2.rectangle(img, (nbx, nby), (nbx2, nby2), (255, 0, 0), 2)
            #     #gt_rois.append([nbx, nby, nbx2, nby2])
            # if cv2.imwrite(os.path.join(cfg.OUTPUT_DIR, str(minibatch_db[0]['id'])+'.png'), img):
            #     printed = 1
            # else:
            #     printed = 0
            pass
        return blobs
示例#2
0
 def get_next_minibatch(self):
     """Return the blobs to be used for the next minibatch. Thread safe."""
     valid = False
     while not valid:
         db_inds = self._get_next_minibatch_inds()
         minibatch_db = [self._roidb[i] for i in db_inds]
         blobs, valid = get_minibatch(minibatch_db)
     return blobs
示例#3
0
 def get_next_minibatch(self):
     """Return the blobs to be used for the next minibatch. Thread safe."""
     valid = False
     while not valid:
         db_inds = self._get_next_minibatch_inds()
         minibatch_db = [self._roidb[i] for i in db_inds]
         blobs, valid = get_minibatch(minibatch_db)
     return blobs
示例#4
0
 def get_next_minibatch(self):
     """Return the blobs to be used for the next minibatch. Thread safe."""
     valid = False
     while not valid:
         db_inds, db_target_inds = self._get_next_minibatch_inds()
         minibatch_db = [self._roidb[i] for i in db_inds]
         if db_target_inds != None:
             minibatch_db += [self._target_roidb[i] for i in db_target_inds]
             print("target minibatch loaded: " + str(db_inds[0]) + " " +
                   str(db_target_inds[0]))
         blobs, valid = get_minibatch(minibatch_db)
     return blobs
示例#5
0
    def get_next_minibatch(self):
        """Return the blobs to be used for the next minibatch. Thread safe."""
        valid = False
        while not valid:
            db_inds = self._get_next_minibatch_inds()
            minibatch_db = [self._roidb[i] for i in db_inds]
            roidb_noclass = dict()
            #print('S6:',S6)
            if S6:#S6:  # for S5
                for roidb_i, roidb_list in enumerate(self._roidb):
                    if roidb_list[u'image']==u'/home/icubic/daily_work/code/Detectron/detectron/datasets/data/aoi/data_all/test.png':
                        #print('test.jpg')
                        roidb_noclass = self._roidb[roidb_i].copy()
                    if 0:
                        if len(roidb_list[u'gt_classes']) == 1 :#and roidb_list[u'gt_classes'][0] ==1:
                            roidb_noclass['1'] = self._roidb[roidb_i]



                        if len(roidb_list[u'gt_classes']) == 2:
                            roidb_noclass['2'] = self._roidb[roidb_i]


                        if len(roidb_list[u'gt_classes']) == 3 and roidb_list[u'gt_classes'][0] ==2:
                            roidb_noclass['3'] = self._roidb[roidb_i]

                        if len(roidb_list[u'gt_classes']) >3:
                            print('more')
                    #roidb_noclass['3'] = self._roidb[roidb_i]
            #if len(minibatch_db[0][u'gt_classes']) == 0:
            #    print('aa')
            if S6:
                blobs, valid = get_minibatch_s6(minibatch_db,roidb_noclass)
            else:
                blobs, valid = get_minibatch(minibatch_db)
        return blobs