| | --- |
| | pretty_name: imagenet3d |
| | extra_gated_fields: |
| | Name: text |
| | Affiliation: text |
| | --- |
| | ## ImageNet3D |
| |
|
| | Refer to [github.com/wufeim/imagenet3d](https://github.com/wufeim/imagenet3d) for the full documentation and sample preprocessing code for ImageNet3D. |
| |
|
| | ### Download Data |
| |
|
| | Directly download from the HuggingFace WebUI, or on a server, run |
| |
|
| | ```py |
| | from huggingface_hub import hf_hub_download |
| | local_path = '/your/local/directory' |
| | hf_hub_download(repo_id='ccvl/ImageNet3D', repo_type='dataset', filename='imagenet3d_0409.zip', local_dir=local_path, local_dir_use_symlinks=False) |
| | ``` |
| |
|
| | ### Example Usage |
| |
|
| | ```py |
| | from PIL import Image |
| | import numpy as np |
| | |
| | img_path = 'imagenet3d/bed/n02818832_13.JPEG' |
| | annot_path = 'imagenet3d/bed/n02818832_13.npz' |
| | |
| | img = np.array(Image.open(img_path).convert('RGB')) |
| | annot = dict(np.load(annot_path, allow_pickle=True))['annotations'] |
| | |
| | # Number of objects |
| | num_objects = len(annot) |
| | |
| | # Annotation of the first object |
| | azimuth = annot[0]['azimuth'] # float, [0, 2*pi] |
| | elevation = annot[0]['elevation'] # float, [0, 2*pi] |
| | theta = annot[0]['theta'] # float, [0, 2*pi] |
| | cad_index = annot[0]['cad_index'] # int |
| | distance = annot[0]['distance'] # float |
| | viewport = annot[0]['viewport'] # int |
| | img_height = annot[0]['height'] # numpy.uint16 |
| | img_width = annot[0]['width'] # numpy.uint16 |
| | bbox = annot[0]['bbox'] # numpy.ndarray, (x1, y1, x2, y2) |
| | category = annot[0]['class'] # str |
| | principal_x = annot[0]['px'] # float |
| | principal_y = annot[0]['py'] # float |
| | |
| | # label indicating the quality of the object, occluded or low quality |
| | object_status = annot[0]['object_status'] # str, one of ('status_good', 'status_partially', 'status_barely', 'status_bad') |
| | |
| | # label indicating if multiple objects from same category very close to each other |
| | dense = annot[0]['dense'] # str, one of ('dense_yes', 'dense_no') |
| | ``` |
| |
|