vitoralbiero / img2pose

The official PyTorch implementation of img2pose: Face Alignment and Detection via 6DoF, Face Pose Estimation - CVPR 2021
Other
588 stars 109 forks source link

TypeError: a bytes-like object is required, not 'NoneType' #74

Closed Algabri closed 1 year ago

Algabri commented 1 year ago

Hi, I am using UBUNTU 20.04.

I got this an error when I run visualize_trained_model_predictions.ipynb

TypeError                                 Traceback (most recent call last)
Cell In[20], line 4
      1 LMDB_FILE = "../../datasets/lmdb/WIDER_val_annotations.lmdb"
      3 # load images that were already compressed from json list to lmdb file
----> 4 lmdb_data_loader = LMDBDataLoader(
      5     Config(
      6         batch_size=1,
      7         pin_memory=True,
      8         workers=1,
      9         pose_mean=pose_mean,
     10         pose_stddev=pose_stddev,
     11         noise_augmentation=False,
     12         contrast_augmentation=False,
     13         threed_68_points='../../pose_references/reference_3d_68_points_trans.npy',
     14         distributed=False
     15     ),
     16     LMDB_FILE,
     17     train=True,
     18 )

File ~/2/6D/img2pose/evaluation/jupyter_notebooks/../../data_loader_lmdb.py:146, in LMDBDataLoader.__init__(self, config, lmdb_path, train)
    143 else:
    144     pose_label_transform = None
--> 146 self._dataset = LMDB(
    147     config, lmdb_path, transform, pose_label_transform, augmentation_methods
    148 )
    150 if config.distributed:
    151     self._sampler = DistributedSampler(self._dataset, shuffle=False)

File ~/2/6D/img2pose/evaluation/jupyter_notebooks/../../data_loader_lmdb.py:38, in LMDB.__init__(self, config, db_path, transform, pose_label_transform, augmentation_methods)
     28 self.env = lmdb.open(
     29     db_path,
     30     subdir=path.isdir(db_path),
   (...)
     34     meminit=False,
     35 )
     37 with self.env.begin(write=False) as txn:
---> 38     self.length = msgpack.loads(txn.get(b"__len__"))
     39     self.keys = msgpack.loads(txn.get(b"__keys__"))
     41 self.transform = transform

File msgpack/_unpacker.pyx:177, in msgpack._cmsgpack.unpackb()

File msgpack/_unpacker.pyx:125, in msgpack._cmsgpack.get_data_from_buffer()

TypeError: a bytes-like object is required, not 'NoneType'

Could you help me? please.

vitoralbiero commented 1 year ago

Hello @Algabri,

Did you created the WIDER_val_annotations.lmdb file using convert_json_list_to_lmdb?

vitoralbiero commented 1 year ago

Closing this issue, if you still are having problems, please re-open it.

Algabri commented 1 year ago

Hello, @vitoralbiero Thank you so much. It is working fine now.

Algabri commented 1 year ago

Dear @vitoralbiero Could you tell me units (x,y,z)? mm, cm, m or pixel? yaw, pitch roll, x,y,z = [ 0.39577428 -0.09979893 0.06264763 0.22263223 -0.22278553 9.77568817] yaw, pitch roll = [-22.89876307 -4.86249479 4.62549184] after converting. I already read your paper, but I did not get it. For example, I am running your code in a real-time video, do you mean by (x,y,z ) as 3 dimensions between the camera and face, Or do they refer to the differences between the mask face and real face of people? Thank you in advance.