triposr
Model Overview
A transformer-based model designed for rapid 3D object reconstruction from a single RGB image, capable of generating high-quality 3D meshes in under 0.5 seconds on an NVIDIA A100 GPU.
Setup your API Key
If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.
Submit a request
API Schema
The URL of the reference image.
The format of the generated image.
glb
Possible values: Enables removing the background from the input image.
Ratio of the foreground image to the original image.
0.9
Resolution of the marching cubes. Above 512 is not recommended.
256
POST /v1/images/generations HTTP/1.1
Host: api.aimlapi.com
Authorization: Bearer <YOUR_AIMLAPI_KEY>
Content-Type: application/json
Accept: */*
Content-Length: 146
{
"model": "triposr",
"image_url": "https://example.com",
"output_format": "glb",
"do_remove_background": true,
"foreground_ratio": 0.9,
"mc_resolution": 256
}
No content
Example
import requests
def main():
response = requests.post(
"https://api.aimlapi.com/v1/images/generations",
headers={
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
"Content-Type": "application/json",
},
json={
"model": "triposr",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/2/22/Fly_Agaric_mushroom_05.jpg/576px-Fly_Agaric_mushroom_05.jpg",
},
)
response.raise_for_status()
data = response.json()
url = data["model_mesh"]["url"]
file_name = data["model_mesh"]["file_name"]
mesh_response = requests.get(url, stream=True)
with open(file_name, "wb") as file:
for chunk in mesh_response.iter_content(chunk_size=8192):
file.write(chunk)
if __name__ == "__main__":
main()
Response:
The example returns a textured 3D mesh in GLB file format. You can view it here.
For clarity, we took several screenshots of our mushroom from different angles in an online GLB viewer. As you can see, the model understands the shape, but preserving the pattern on the back side (which was not visible on the reference image) could be improved:
Compare them with the reference image:
Last updated
Was this helpful?