CCP icon indicating copy to clipboard operation
CCP copied to clipboard

only got val_acc of 20.22 on the validation set after trained for 200 epochs

Open Jacksky2017 opened this issue 3 years ago • 0 comments

Hi~ the code of generating the file 'instanceSegDB_person_train.pkl' seems to be absent. So, I borrowed some code from your repository of 'PointTrack' and amended them to get the right formation of the instances blocks, illustrated below. I'm not sure whether they are right or not. The generated file 'instanceSegDB_person_train.pkl' contains 74 instances blocks with the source from the training set of Kitti MOTS. Without KINS for finetuning, I used 'python train_e2e.py person_mots_ccpnet' to train the model on 5 GPUs for 200 epochs with an initial learning rate '5e-4'. Finally, I only got val_acc of 20.22. I'm confused where is the problem?

Looking forward to your reply!

OBJ_ID = 2
instIDs = dict()
instList = dict()
count=0
SEQ_IDS_TRAIN = ["%04d" % idx for idx in [0, 1, 3, 4, 5, 9, 11, 12, 15, 17, 19, 20]]
SEQ_IDS_VAL = ["%04d" % idx for idx in [2, 6, 7, 8, 10, 13, 14, 16, 18]]

def getImgLabel(img_path, label_path):
    img = cv2.imread(img_path)
    label = np.array(Image.open(label_path))
    mask = np.logical_and(label >= OBJ_ID * 1000, label < (OBJ_ID + 1) * 1000)
    label[(1-mask).astype(np.bool)] = 0
    return img, label

def getPairs(id):
    global instIDs, instList, count
    label_root = os.path.join(kittiRoot, "instances/" + id)
    image_root = label_root.replace('instances', 'images')

    image_list = make_dataset(image_root, suffix='.png')
    image_list.sort()
    label_list = make_dataset(label_root, suffix='.png')
    label_list.sort()
    count_offset = count
    for ind, image_path in enumerate(image_list):
        img, label = getImgLabel(image_list[ind], label_list[ind])
        if np.unique(label).shape[0] == 1:
            continue

        obj_ids = np.unique(label).tolist()[1:]
        for id in obj_ids:
            mask = (label == id).astype(np.uint8)
            vs, us = np.nonzero(mask)
            v0, v1 = vs.min(), vs.max()
            u0, u1 = us.min(), us.max()
            inst_id = id + count_offset
            sp = [v0, u0]
            imgCrop = img[v0:v1 + 1, u0:u1 + 1]
            xyxy = [u0, v0, u1, v1]
            maskCrop = mask[v0:v1 + 1, u0:u1 + 1]
            if inst_id in instIDs.keys():
                instList[instIDs[inst_id]].append({'inst_id': inst_id, 'sp': sp, 'xyxy': xyxy, 'img': imgCrop, 'mask': maskCrop})
            else:
                
                instIDs[inst_id] = count
                instList[count] = [{'inst_id': inst_id, 'sp': sp, 'xyxy': xyxy, 'img': imgCrop, 'mask': maskCrop}]
                count = count + 1

for i in SEQ_IDS_TRAIN:
    getPairs(i)
    print('process %s seq' % i)
print('trainSet %s samples' % count)
save_pickle2(os.path.join(kittiRoot, 'instanceSegDB_person_train.pkl'), instList)

Jacksky2017 avatar Nov 23 '21 06:11 Jacksky2017