9. Fine-tuning Mask-RCNN detector part

1.  without gt mask

(1)in mot.py
class mot(imdb):
self.mask_size = cfg.TRAIN.MASK_SIZE #MRCNN $x=28
self.binary_thresh = 0.4 #MRCNN

(2) def _load_mot_annotation(self, index):
seg_mask_inds = np.zeros((num_objs, 2), dtype=np.uint32) #MRCNN # save image index
and object index in this image

### MRCNN (need to be tested)
if cfg.TRAIN.MASK_REG:
#index has form: index = "MOT16-02_000003" --> has to parse into integer number
index_t=index.strip()
arr = index_t.split('_')

index_t2=int(arr[0][6:]+arr[1]) ##tranfer MOT16-02_000003 --> 2000003
seg_mask_inds[ix, : ] = [index_t2, ix+1] #instance count from 1

### MRCNN-seg
im_size=tree.find('size')
im_width=int(im_size.find('width').text)
#print 'im_width:',im_width
im_height=int(im_size.find('height').text)
#print 'im_height:',im_height


seg_mask_save= np.zeros((im_height, im_width), dtype=np.int8) #file size still a little bigger!!!
seg_mask_path = './data/cache/GTsegmask_MOT_2016_train/' + str(index) + '_' + str(ix+1) + '_segmask.sm'
print 'seg_mask_path:',seg_mask_path
with open(seg_mask_path, 'wb') as f_seg_save:
cPickle.dump(seg_mask_save, f_seg_save, cPickle.HIGHEST_PROTOCOL)



if not cfg.TRAIN.MASK_REG: # without mask-branch
else: ### MRCNN
return {'boxes' : boxes,
'gt_classes' : gt_classes,
'gt_overlaps' : overlaps,
'flipped' : False, #--->object from original image, not fliping
'seg_areas' : seg_areas,
'seg_mask_inds' : seg_mask_inds}



(2) in config.py

__C.TRAIN.TRAINING_DATA = 'MOT_2016_train' #MRCNN

Comments

Popular posts from this blog

github accumulation

7. compile faster-r-cnn