triposr

This documentation is valid for the following list of our models:

  • 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

post
Authorizations
Body
modelundefined · enumRequiredPossible values:
image_urlstring · uriRequired

The URL of the reference image.

output_formatstring · enumOptional

The format of the generated image.

Default: glbPossible values:
do_remove_backgroundbooleanOptional

Enables removing the background from the input image.

foreground_rationumber · min: 0.5 · max: 1Optional

Ratio of the foreground image to the original image.

Default: 0.9
mc_resolutioninteger · min: 32 · max: 1024Optional

Resolution of the marching cubes. Above 512 is not recommended.

Default: 256
Responses
201Success
post
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
}
201Success

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:

Try to choose reference images where the target object is not obstructed by other objects and does not blend into the background. Depending on the complexity of the object, you may need to experiment with the resolution of the reference image to achieve a satisfactory mesh.

Last updated

Was this helpful?