allenai / objaverse-xl

🪐 Objaverse-XL is a Universe of 10M+ 3D Objects. Contains API Scripts for Downloading and Processing!
https://objaverse.allenai.org/
Apache License 2.0
704 stars 40 forks source link

integrate_Cap3D_captions #19

Open tiangeluo opened 9 months ago

tiangeluo commented 9 months ago

This PR integrates Cap3D captions into Objaverse annotations along with point-clouds download link.

objaverse.load_uids() will first download a cap3d_captions.json.gz file locally and then assign captions to each inquired UID. For pointclouds, user should follow the download link to download the zip files with point clouds stored as .ply and .pt.

Specifically, the Cap3D caption and the point-cloud download link are displayed in the last two lines. One example is the below.

import objaverse
uids = objaverse.load_uids()
annotations = objaverse.load_annotations(uids)
annotations["ysqP6VH2x99bODrQRbcYdQjSLjV"]

{'uri': 'https://api.sketchfab.com/v3/models/ysqP6VH2x99bODrQRbcYdQjSLjV',
 'uid': 'ysqP6VH2x99bODrQRbcYdQjSLjV',
 'name': 'Tiko',
 'staffpickedAt': '2013-06-19T08:56:52',
 'viewCount': 937,
 'likeCount': 27,
 'animationCount': 0,
 'viewerUrl': 'https://sketchfab.com/3d-models/ysqP6VH2x99bODrQRbcYdQjSLjV',
 'embedUrl': 'https://sketchfab.com/models/ysqP6VH2x99bODrQRbcYdQjSLjV/embed',
 'commentCount': 4,
 'isDownloadable': True,
 'publishedAt': '2013-06-17T05:01:56',
 'tags': [{'name': '3dcoat',
   'slug': '3dcoat',
   'uri': 'https://api.sketchfab.com/v3/tags/3dcoat'},
  {'name': 'sketchfast5',
   'slug': 'sketchfast5',
   'uri': 'https://api.sketchfab.com/v3/tags/sketchfast5'},
  {'name': 'staffpicks',
   'slug': 'staffpicks',
   'uri': 'https://api.sketchfab.com/v3/tags/staffpicks'},
  {'name': 'blender',
   'slug': 'blender',
   'uri': 'https://api.sketchfab.com/v3/tags/blender'},
  {'name': 'art',
   'slug': 'art',
   'uri': 'https://api.sketchfab.com/v3/tags/art'}],
 'categories': [],
 'thumbnails': {'images': [{'uid': '962ec9c15cbf40d48e531ae9ea37245c',
    'size': 157076,
    'width': 1920,
    'url': 'https://media.sketchfab.com/models/ysqP6VH2x99bODrQRbcYdQjSLjV/thumbnails/537654ca708642c29b533e689e5f8b5b/b8c2ee6aa6e04bf6b4066b76e0e1c477.jpeg',
    'height': 1080},
   {'uid': 'b9f16c31871049bea4937d291759310c',
    'size': 41138,
    'width': 1024,
    'url': 'https://media.sketchfab.com/models/ysqP6VH2x99bODrQRbcYdQjSLjV/thumbnails/537654ca708642c29b533e689e5f8b5b/41428fa34289463fa66054479d366905.jpeg',
    'height': 576},
   {'uid': 'f69b19b325b34fe18b1814585aa9c25e',
    'size': 22768,
    'width': 720,
    'url': 'https://media.sketchfab.com/models/ysqP6VH2x99bODrQRbcYdQjSLjV/thumbnails/537654ca708642c29b533e689e5f8b5b/bd83c4a46304443c94772f419936d507.jpeg',
    'height': 405},
   {'uid': 'cdc9a424136440d1abe8fc982e05fc9e',
    'size': 4606,
    'width': 256,
    'url': 'https://media.sketchfab.com/models/ysqP6VH2x99bODrQRbcYdQjSLjV/thumbnails/537654ca708642c29b533e689e5f8b5b/bd122ebde94748e19a947cb6d3e75b37.jpeg',
    'height': 144},
   {'uid': '744290d632c849e4a2e8e1d8f1f9bd53',
    'size': 820,
    'width': 64,
    'url': 'https://media.sketchfab.com/models/ysqP6VH2x99bODrQRbcYdQjSLjV/thumbnails/537654ca708642c29b533e689e5f8b5b/bae26559d66e419d8af802d1a1cd65cb.jpeg',
    'height': 36}]},
 'user': {'uid': 'ee628401f8414f15a8b72ea5586f7822',
  'username': 'zafio',
  'displayName': 'Zafio',
  'profileUrl': 'https://sketchfab.com/zafio',
  'account': 'basic',
  'avatar': {'uri': 'https://api.sketchfab.com/v3/avatars/b19596b7e6534d69bed828007e99f579',
   'images': [{'size': 641,
     'width': 32,
     'url': 'https://media.sketchfab.com/avatars/b19596b7e6534d69bed828007e99f579/efe9788ae68f443881ff834b5934be86.jpeg',
     'height': 32},
    {'size': 953,
     'width': 48,
     'url': 'https://media.sketchfab.com/avatars/b19596b7e6534d69bed828007e99f579/6e9e9358d62d48a8a42268e182f754ac.jpeg',
     'height': 48},
    {'size': 2039,
     'width': 90,
     'url': 'https://media.sketchfab.com/avatars/b19596b7e6534d69bed828007e99f579/9dcc185f3f914074a0b8632a79fe193c.jpeg',
     'height': 90},
    {'size': 2322,
     'width': 100,
     'url': 'https://media.sketchfab.com/avatars/b19596b7e6534d69bed828007e99f579/5ea780bebf384360bedd117c3adc68ec.jpeg',
     'height': 100}]},
  'uri': 'https://api.sketchfab.com/v3/users/ee628401f8414f15a8b72ea5586f7822'},
 'description': '',
 'faceCount': 49862,
 'createdAt': '2013-06-17T05:01:56',
 'vertexCount': 25242,
 'isAgeRestricted': False,
 'archives': {'glb': {'textureCount': 5,
   'size': 11189196,
   'type': 'glb',
   'textureMaxResolution': 2048,
   'faceCount': 54470,
   'vertexCount': 30300},
  'gltf': {'textureCount': 5,
   'size': 10025782,
   'type': 'gltf',
   'textureMaxResolution': 2048,
   'faceCount': 54470,
   'vertexCount': 30300},
  'source': {'textureCount': None,
   'size': 8120079,
   'type': 'source',
   'textureMaxResolution': None,
   'faceCount': None,
   'vertexCount': None},
  'usdz': {'textureCount': None,
   'size': 6374448,
   'type': 'usdz',
   'textureMaxResolution': None,
   'faceCount': None,
   'vertexCount': None}},
 'license': 'by',
 'cap3d': {'caption': 'a small purple toy monster.',
  'pointcloud_download_url': 'https://huggingface.co/datasets/tiange/Cap3D/tree/main/PointCloud_zips',
  'paper': 'Scalable 3D Captioning with Pretrained Models'}}