DirtyHarryLYL / DJ-RN

As a part of HAKE project (HAKE-3D). Code for our CVPR2020 paper "Detailed 2D-3D Joint Representation for Human-Object Interaction".
Apache License 2.0
100 stars 13 forks source link

How should I exactly run the script/assign_pose_GT.py script? #49

Closed monacv closed 3 years ago

monacv commented 3 years ago

How do you run the following script for both train and test portions of HICO-DET dataset since, in step 4, I had to run it separately for the train and test portion?

The script/assign_pose_GT.py dumps the results into a file called Data/Trainval_GT_HICO_with_idx.pkl

$ python script/assign_pose_GT.py --pose ../../data/smplify-x/djrn_test_data/ --res ../../data/smplify-x/djrn_test_results

Do you only run it on the train portion of the hico_det dataset? I ask because I ran it on the test portion of the hico_det dataset and didn't get an error however the following lines of the script perhaps hint we should run it on the train portion?

Previously, I ran the following two scripts in step 4 of data processing:

For train portion of HICO-DET:

export CUDA_VISIBLE_DEVICES=0
python smplifyx/main.py --config cfg_files/fit_smplx.yaml --data_folder ../../data/smplify-x/djrn_train_data/ --output_folder ../../data/smplify-x/djrn_train_results --visualize="False" --model_folder ../../data/smplify-x/models_smplx_v1_1/models/smplx/SMPLX_NEUTRAL.npz --vposer_ckpt ../../data/smplify-x/vposer_v1_0 --part_segm_fn ../../data/smplify-x/smplx_parts_segm.pkl

For test portion of HICO-DET: python smplifyx/main.py --config cfg_files/fit_smplx.yaml --data_folder ../../data/smplify-x/djrn_test_data/ --output_folder ../../data/smplify-x/djrn_test_results --visualize="False" --model_folder ../../data/smplify-x/models_smplx_v1_1/models/smplx/SMPLX_NEUTRAL.npz --vposer_ckpt ../../data/smplify-x/vposer_v1_0 --part_segm_fn ../../data/smplify-x/smplx_parts_segm.pkl Additionally, if you could please provide some comments on what this script does at a higher level? That would be very helpful.

    if os.path.exists(os.path.join(args.pose, 'HICO_train2015_%08d_keypoints.json' % key)):
        f = json.load(open(os.path.join(args.pose, 'HICO_train2015_%08d_keypoints.json' % key)))
        for i in range(len(f['people'])):
            tmp = np.array(f['people'][i]['pose_keypoints_2d'])
            if not os.path.exists(os.path.join(args.res, 'results/HICO_train2015_%08d/%03d.pkl' % (key, i))):
                continue
            body_pose = tmp.reshape(-1, 3)[body25_to_coco, :2]
            tmp_sum = np.sum(body_pose, axis=1)
            sel = np.where(tmp_sum > 0)[0]
            body_pose = body_pose[sel, :]

            for j in range(len(data[key])):
                if data[key][j][5] is not None:
                    alphapose = np.array(data[key][j][5]).reshape(-1, 3)[sel, :2]
                    dis = calc_mse(body_pose, alphapose)
                    if (used[j] < 0 and dis < 500) or (dis < used[j]):
                        used[j] = dis
                        data[key][j][-1] = i
pickle.dump(data, open('Data/Trainval_GT_HICO_with_idx.pkl', 'wb'), protocol=2)
Foruck commented 3 years ago

As stated in https://github.com/DirtyHarryLYL/DJ-RN#data-generation step 5, all the three commands should be performed. And we would consider adding proper comments on the scripts.