objathor


Nameobjathor JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/allenai/objathor
SummaryObjaverse asset importer for THOR
upload_time2024-05-08 21:59:40
maintainerNone
docs_urlNone
authorAllen Institute for AI
requires_pythonNone
licenseApache 2.0
keywords 3d assets annotation
VCS
bugtrack_url
requirements numpy tqdm compress_pickle filelock compress_json scikit-image objaverse trimesh msgpack filelock
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ObjaTHOR

Objaverse asset annotator and importer for use in THOR.

## Installation

Install ai2thor:

```bash
pip install --extra-index-url https://ai2thor-pypi.allenai.org ai2thor==0+40679c517859e09c1f2a5e39b65ee7f33fcfdd48
```

Install other dependencies:

```bash
pip install objathor[annotation]
```

Here the following extras are installed: `annotation` to use openai to generate annotations. Also for annotation functionality you must install `nltk` [Install nltk](#nltk-dependencies). To generate renders and convert 'glb' models in the conversion pipeline you must [Install Blender](#blender-install-instructions) .

From source:

```bash
pip install -e ".[annotation]"
```

We recommend setting an environment variable with your OpenAI key:

```bash
export OPENAI_API_KEY=[Your key]
```

If you're planning to annotate objects for which we don't have pre-generated
views in S3 (see an example under [Annotation](#annotation) below), we also need to install blender either as an extra (as shown above) or as an application:

### Blender install instructions
Installing  the `Blender` as a module:
```bash
pip install bpy
```
Installing  the Blender as a module, requires a python `3.10` environment.

Or installing blender as an application:
[Blender install instructions](https://docs.blender.org/manual/en/latest/getting_started/installing/index.html)

If application is not in the cannonical directories you may need to pass `blender_installation_path` to scripts that use Blender.


### NLTK dependencies

Install `nltk` on this commit by running:

```bash
pip install git+https://github.com/nltk/nltk@582e6e35f0e6c984b44ec49dcb8846d9c011d0a8
```

During the first run, NLTK dependencies are automatically installed, but we can also install them ahead:

```bash
python -c "import nltk; nltk.download('punkt'); nltk.download('wordnet2022'); nltk.download('brown'); nltk.download('averaged_perceptron_tagger')"
```


### Pre-generated synset definition embeddings for Annotation

For automatic annotation to assign likely synsets given the automatically generated asset description, we can
pre-install pre-generated embeddings for all synset definitions (this can be useful if we cannot write into our home
directory at run time):

```bash
mkdir ~/.objathor_data
curl https://prior-datasets.s3.us-east-2.amazonaws.com/vida-synset-embeddings/synset_definition_embeddings_single.pkl.gz -o ~/.objathor_data/synset_definition_embeddings_single.pkl.gz
```

### AI2-THOR binary pre-downloading

Assuming we're running on a remote Linux server, we can pre-download the THOR binaries with:

```bash
python -c "from ai2thor.controller import Controller; from objathor.constants import THOR_COMMIT_ID; c=Controller(download_only=True, platform='CloudRendering', commit_id=THOR_COMMIT_ID)"
```

(`platform='OSXIntel64'` would be used for a MacOS environment).

## Usage

### Annotation

You must install the `annotation` extra requirement through pip, ad have blender installed,
either standalone or as a module. The following command will generate annotation, via GPT-4,
and also generate the conversion to a valid THOR asset.

```bash
OUTPUT_DIR=/path/to/output
python -m objathor.main \
--uid 0070ac4bf50b496387365843d4bf5432 \
--output "$OUTPUT_DIR"
```

### GLB to THOR asset conversion

From the repository root run:

```
python 
-m objathor.asset_conversion.pipeline_to_thor 
--object_ids=000074a334c541878360457c672b6c2e 
--output_dir=<some_absolute_path>
--extension=.msgpack.gz
 --annotations=<annotations_file_path> 
--live 
--blender_as_module
```

Where `object_ids` is a string of comma separated list of `Objaverse` object ids to process.
`output_dir` is an absolute path indicating where to write the output of the conversion.
`annotations` is optional, and is the path to an annotations file as generated by the process described above.

Run `python -m objathor.asset_conversion.pipeline_to_thor --help` for other options.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/allenai/objathor",
    "name": "objathor",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "3D assets, annotation, ",
    "author": "Allen Institute for AI",
    "author_email": "contact@allenai.org",
    "download_url": "https://files.pythonhosted.org/packages/ed/3d/879d15e5ad92e2ad73879b6879023dfa893179ffce218a56e0594f857007/objathor-0.0.5.tar.gz",
    "platform": null,
    "description": "# ObjaTHOR\n\nObjaverse asset annotator and importer for use in THOR.\n\n## Installation\n\nInstall ai2thor:\n\n```bash\npip install --extra-index-url https://ai2thor-pypi.allenai.org ai2thor==0+40679c517859e09c1f2a5e39b65ee7f33fcfdd48\n```\n\nInstall other dependencies:\n\n```bash\npip install objathor[annotation]\n```\n\nHere the following extras are installed: `annotation` to use openai to generate annotations. Also for annotation functionality you must install `nltk` [Install nltk](#nltk-dependencies). To generate renders and convert 'glb' models in the conversion pipeline you must [Install Blender](#blender-install-instructions) .\n\nFrom source:\n\n```bash\npip install -e \".[annotation]\"\n```\n\nWe recommend setting an environment variable with your OpenAI key:\n\n```bash\nexport OPENAI_API_KEY=[Your key]\n```\n\nIf you're planning to annotate objects for which we don't have pre-generated\nviews in S3 (see an example under [Annotation](#annotation) below), we also need to install blender either as an extra (as shown above) or as an application:\n\n### Blender install instructions\nInstalling  the `Blender` as a module:\n```bash\npip install bpy\n```\nInstalling  the Blender as a module, requires a python `3.10` environment.\n\nOr installing blender as an application:\n[Blender install instructions](https://docs.blender.org/manual/en/latest/getting_started/installing/index.html)\n\nIf application is not in the cannonical directories you may need to pass `blender_installation_path` to scripts that use Blender.\n\n\n### NLTK dependencies\n\nInstall `nltk` on this commit by running:\n\n```bash\npip install git+https://github.com/nltk/nltk@582e6e35f0e6c984b44ec49dcb8846d9c011d0a8\n```\n\nDuring the first run, NLTK dependencies are automatically installed, but we can also install them ahead:\n\n```bash\npython -c \"import nltk; nltk.download('punkt'); nltk.download('wordnet2022'); nltk.download('brown'); nltk.download('averaged_perceptron_tagger')\"\n```\n\n\n### Pre-generated synset definition embeddings for Annotation\n\nFor automatic annotation to assign likely synsets given the automatically generated asset description, we can\npre-install pre-generated embeddings for all synset definitions (this can be useful if we cannot write into our home\ndirectory at run time):\n\n```bash\nmkdir ~/.objathor_data\ncurl https://prior-datasets.s3.us-east-2.amazonaws.com/vida-synset-embeddings/synset_definition_embeddings_single.pkl.gz -o ~/.objathor_data/synset_definition_embeddings_single.pkl.gz\n```\n\n### AI2-THOR binary pre-downloading\n\nAssuming we're running on a remote Linux server, we can pre-download the THOR binaries with:\n\n```bash\npython -c \"from ai2thor.controller import Controller; from objathor.constants import THOR_COMMIT_ID; c=Controller(download_only=True, platform='CloudRendering', commit_id=THOR_COMMIT_ID)\"\n```\n\n(`platform='OSXIntel64'` would be used for a MacOS environment).\n\n## Usage\n\n### Annotation\n\nYou must install the `annotation` extra requirement through pip, ad have blender installed,\neither standalone or as a module. The following command will generate annotation, via GPT-4,\nand also generate the conversion to a valid THOR asset.\n\n```bash\nOUTPUT_DIR=/path/to/output\npython -m objathor.main \\\n--uid 0070ac4bf50b496387365843d4bf5432 \\\n--output \"$OUTPUT_DIR\"\n```\n\n### GLB to THOR asset conversion\n\nFrom the repository root run:\n\n```\npython \n-m objathor.asset_conversion.pipeline_to_thor \n--object_ids=000074a334c541878360457c672b6c2e \n--output_dir=<some_absolute_path>\n--extension=.msgpack.gz\n --annotations=<annotations_file_path> \n--live \n--blender_as_module\n```\n\nWhere `object_ids` is a string of comma separated list of `Objaverse` object ids to process.\n`output_dir` is an absolute path indicating where to write the output of the conversion.\n`annotations` is optional, and is the path to an annotations file as generated by the process described above.\n\nRun `python -m objathor.asset_conversion.pipeline_to_thor --help` for other options.\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Objaverse asset importer for THOR",
    "version": "0.0.5",
    "project_urls": {
        "Homepage": "https://github.com/allenai/objathor"
    },
    "split_keywords": [
        "3d assets",
        " annotation",
        " "
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7c375c1431dfa0866ecd109c83be02e97ece856e5ccd6d86918e4596745f8550",
                "md5": "7b5d39403a874614f50635fb6f61bca6",
                "sha256": "ce54b0faddf58775d328270e3472a6a42edf700e5bfb444cb805a1d5798aab1e"
            },
            "downloads": -1,
            "filename": "objathor-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7b5d39403a874614f50635fb6f61bca6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 86272,
            "upload_time": "2024-05-08T21:59:38",
            "upload_time_iso_8601": "2024-05-08T21:59:38.527392Z",
            "url": "https://files.pythonhosted.org/packages/7c/37/5c1431dfa0866ecd109c83be02e97ece856e5ccd6d86918e4596745f8550/objathor-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed3d879d15e5ad92e2ad73879b6879023dfa893179ffce218a56e0594f857007",
                "md5": "efabfdbd8611c0e0662a3312bcde390b",
                "sha256": "573ce77f8ed726d86af1684f7d3f059561f9c7d6e2d8ea4cfec6a67335ce23be"
            },
            "downloads": -1,
            "filename": "objathor-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "efabfdbd8611c0e0662a3312bcde390b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 71598,
            "upload_time": "2024-05-08T21:59:40",
            "upload_time_iso_8601": "2024-05-08T21:59:40.221456Z",
            "url": "https://files.pythonhosted.org/packages/ed/3d/879d15e5ad92e2ad73879b6879023dfa893179ffce218a56e0594f857007/objathor-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-08 21:59:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "allenai",
    "github_project": "objathor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.23.5"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": [
                [
                    ">=",
                    "4.66.1"
                ]
            ]
        },
        {
            "name": "compress_pickle",
            "specs": [
                [
                    ">=",
                    "2.1.0"
                ]
            ]
        },
        {
            "name": "filelock",
            "specs": [
                [
                    ">=",
                    "3.13.1"
                ]
            ]
        },
        {
            "name": "compress_json",
            "specs": [
                [
                    ">=",
                    "1.0.10"
                ]
            ]
        },
        {
            "name": "scikit-image",
            "specs": [
                [
                    ">=",
                    "0.21.0"
                ]
            ]
        },
        {
            "name": "objaverse",
            "specs": [
                [
                    ">=",
                    "0.1.7"
                ]
            ]
        },
        {
            "name": "trimesh",
            "specs": [
                [
                    ">=",
                    "4.0.1"
                ]
            ]
        },
        {
            "name": "msgpack",
            "specs": [
                [
                    ">=",
                    "1.0.7"
                ]
            ]
        },
        {
            "name": "filelock",
            "specs": [
                [
                    ">=",
                    "3.13.1"
                ]
            ]
        }
    ],
    "lcname": "objathor"
}
        
Elapsed time: 0.24736s