{"id":30767522,"url":"https://github.com/diyer22/bpycv","last_synced_at":"2025-09-04T20:05:52.952Z","repository":{"id":36861570,"uuid":"230749263","full_name":"DIYer22/bpycv","owner":"DIYer22","description":"Computer vision utils for Blender (generate instance annoatation, depth and 6D pose by one line code)","archived":false,"fork":false,"pushed_at":"2025-08-05T08:04:58.000Z","size":335,"stargazers_count":489,"open_issues_count":5,"forks_count":59,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-09-04T20:03:17.488Z","etag":null,"topics":["6dof-pose","blender","blender-cv","blender-python","computer-vision","data-synthesis","dataset-generation","deep-learning","depth","instance-segmentation","synthetic-datasets","ycb"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DIYer22.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-29T12:46:59.000Z","updated_at":"2025-08-05T08:05:01.000Z","dependencies_parsed_at":"2025-09-04T20:03:18.725Z","dependency_job_id":null,"html_url":"https://github.com/DIYer22/bpycv","commit_stats":{"total_commits":163,"total_committers":7,"mean_commits":"23.285714285714285","dds":0.07361963190184051,"last_synced_commit":"0b1157a6601106d4c8387c13703000e26a2937aa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DIYer22/bpycv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DIYer22%2Fbpycv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DIYer22%2Fbpycv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DIYer22%2Fbpycv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DIYer22%2Fbpycv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DIYer22","download_url":"https://codeload.github.com/DIYer22/bpycv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DIYer22%2Fbpycv/sbom","scorecard":{"id":35373,"data":{"date":"2025-08-11","repo":{"name":"github.com/DIYer22/bpycv","commit":"9f4a04ef0815384a4a4ede23e33fb3e1bf7cbfab"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":6,"reason":"5 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 6","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:3: pin your Docker image by updating nytimes/blender:3.2-gpu-ubuntu18.04 to nytimes/blender:3.2-gpu-ubuntu18.04@sha256:5cc5c25f7db4cecd3edaa496c07997ebf2d76b0cdf6f0996ecc7d08c7eaa6530","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"37 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-267x-w5hx-8hjr","Warn: Project is vulnerable to: GHSA-33h2-69j3-r336","Warn: Project is vulnerable to: GHSA-3448-vrgh-85xr","Warn: Project is vulnerable to: GHSA-5rpc-gwh9-q9fg","Warn: Project is vulnerable to: GHSA-634c-v2xv-ffpg","Warn: Project is vulnerable to: GHSA-6v6p-p97v-g2p7","Warn: Project is vulnerable to: GHSA-83rh-hx5x-q9p5","Warn: Project is vulnerable to: GHSA-8849-5h85-98qw","Warn: Project is vulnerable to: GHSA-89rj-5ggj-3p9p","Warn: Project is vulnerable to: GHSA-8w3x-457r-wg53","Warn: Project is vulnerable to: GHSA-9g8h-pjm4-q92p","Warn: Project is vulnerable to: GHSA-c7gp-2pch-qh2v","Warn: Project is vulnerable to: GHSA-cvhw-2593-5j2q","Warn: Project is vulnerable to: GHSA-fffj-9qwg-qmh5","Warn: Project is vulnerable to: GHSA-fm39-cw8h-3p63","Warn: Project is vulnerable to: GHSA-fr58-2xhv-qp3w","Warn: Project is vulnerable to: GHSA-fvq6-392h-6mjj","Warn: Project is vulnerable to: GHSA-fw99-f933-rgh8","Warn: Project is vulnerable to: GHSA-hxfw-jm98-v4mq","Warn: Project is vulnerable to: GHSA-jcxv-2j3h-mg59","Warn: Project is vulnerable to: GHSA-jggw-2q6g-c3m6","Warn: Project is vulnerable to: GHSA-m43c-649m-pm48","Warn: Project is vulnerable to: GHSA-m6vm-8g8v-xfjh","Warn: Project is vulnerable to: GHSA-pqjj-6f5q-gqph","Warn: Project is vulnerable to: GHSA-q799-q27x-vp7w","Warn: Project is vulnerable to: GHSA-qr4w-53vh-m672","Warn: Project is vulnerable to: GHSA-rqxg-xvcq-3v2f","Warn: Project is vulnerable to: GHSA-vc29-rj92-gc7j","Warn: Project is vulnerable to: GHSA-w96g-3p64-63wr","Warn: Project is vulnerable to: GHSA-wq8f-wvqp-xvvm","Warn: Project is vulnerable to: GHSA-x3rm-644h-67m8","Warn: Project is vulnerable to: PYSEC-2023-183","Warn: Project is vulnerable to: PYSEC-2014-14 / GHSA-652x-xj99-gmcc","Warn: Project is vulnerable to: GHSA-9hjg-9r4m-mvj7","Warn: Project is vulnerable to: GHSA-9wx4-h78v-vm56","Warn: Project is vulnerable to: PYSEC-2014-13 / GHSA-cfj3-7x9c-4p3h","Warn: Project is vulnerable to: PYSEC-2018-28 / GHSA-x84v-xcm2-53pg"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-14T20:10:54.553Z","repository_id":36861570,"created_at":"2025-08-14T20:10:54.553Z","updated_at":"2025-08-14T20:10:54.553Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273665993,"owners_count":25146277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["6dof-pose","blender","blender-cv","blender-python","computer-vision","data-synthesis","dataset-generation","deep-learning","depth","instance-segmentation","synthetic-datasets","ycb"],"created_at":"2025-09-04T20:03:11.949Z","updated_at":"2025-09-04T20:05:52.935Z","avatar_url":"https://github.com/DIYer22.png","language":"Python","readme":"# `bpycv`: Computer Vision and Deep Learning Utils for Blender\n\n### Contents: [Features](#-features) | [Install](#-install) | [Demo](#-demo) | [Tips](#-tips) \n\n![0](https://user-images.githubusercontent.com/10448025/115022704-55937980-9ef0-11eb-952e-c85eb5fad4b8.jpg)      \n*Figure.1 Render instance annoatation, RGB image and depth*\n\n## ▮ Features\n - [x] Render annotations for semantic segmentation, instance segmentation and panoptic segmentation \n - [x] Generate 6DoF pose ground truth\n - [x] Render depth ground truth\n - [x] Pre-defined domain randomization: \n    - [Light and background](https://github.com/DIYer22/bpycv_example_data/tree/main/background_and_light), automatic download from [HDRI Haven](https://hdrihaven.com/hdris/)\n    - [Distractors](https://arxiv.org/pdf/1804.06516) from [ShapeNet](https://shapenet.org/) (e.g. vase, painting, pallet in Figure.1)\n    - Textures from [Texture Haven](https://texturehaven.com/textures/)\n - [x] Easy installation and demo running\n - [x] Docker support: `docker run -v /tmp:/tmp diyer22/bpycv` (see [Dockerfile](Dockerfile))\n - [x] A Python Codebase for building synthetic datasets (see [example/ycb_demo.py](example/ycb_demo.py))\n - [x] Conversion to [Cityscapes annotation format](https://github.com/DIYer22/bpycv/issues/38)\n - [x] Easy development and debugging due to:\n    - No complicated packaging\n    - Use of Blender's native API and calling methods\n\n**Our Projects that rely on `bpycv`:** \n- 🔬 Research: [Building Five Irregular Shape Instance Segmentation Datasets](https://github.com/iShape/build_synthetic_ishape)\n- 🎮 Demo: [3D Reconstruction + Blender Data Synthesis + AutoML == Free  Detection and Segmentation Model](https://www.youtube.com/watch?v=qTKNQu30rhM)\n- 🥈 Achievement: [We win 2nd place in IROS 2020 Open Cloud Robot Table Organization Challenge (OCRTOC)](https://github.com/DIYer22/bpycv/issues/15)\n\n## ▮ Install\n`bpycv` support Blender 2.9, 3.x, 4.x\n\n1. Download and install Blender [here](https://www.blender.org/download/).\n\n2. Open Blender dir in terminal and run install script:\n\n```bash\n# For Windows user: ensure powershell has administrator permission\n# For MacOS user: replace ./blender to /Applications/Blender.app/Contents/MacOS/Blender\n\n# Ensure pip: equl to /blender-path/3.xx/python/bin/python3.10 -m ensurepip\n./blender -b --python-expr \"from subprocess import sys,call;call([sys.executable,'-m','ensurepip'])\"\n# Update pip toolchain\n./blender -b --python-expr \"from subprocess import sys,call;call([sys.executable]+'-m pip install -U pip setuptools wheel'.split())\"\n# pip install bpycv\n./blender -b --python-expr \"from subprocess import sys,call;call([sys.executable]+'-m pip install -U bpycv'.split())\"\n# Check bpycv ready\n./blender -b -E CYCLES --python-expr \"import bpycv,cv2;d=bpycv.render_data();bpycv.tree(d);cv2.imwrite('/tmp/try_bpycv_vis(inst-rgb-depth).jpg', d.vis()[...,::-1])\"\n```\n\n## ▮ Demo\n#### 1. Fast Instance Segmentation and Depth Demo\nCopy-paste this code to `Scripting/Text Editor` and click `Run Script` button(or `Alt+P`)\n```python\nimport cv2\nimport bpy\nimport bpycv\nimport random\nimport numpy as np\n\n# remove all MESH objects\n[bpy.data.objects.remove(obj) for obj in bpy.data.objects if obj.type == \"MESH\"]\n\nfor index in range(1, 20):\n    # create cube and sphere as instance at random location\n    location = [random.uniform(-2, 2) for _ in range(3)]\n    if index % 2:\n        bpy.ops.mesh.primitive_cube_add(size=0.5, location=location)\n        categories_id = 1\n    else:\n        bpy.ops.mesh.primitive_uv_sphere_add(radius=0.5, location=location)\n        categories_id = 2\n    obj = bpy.context.active_object\n    # set each instance a unique inst_id, which is used to generate instance annotation.\n    obj[\"inst_id\"] = categories_id * 1000 + index\n\n# render image, instance annoatation and depth in one line code\nresult = bpycv.render_data()\n# result[\"ycb_meta\"] is 6d pose GT\n\n# save result\ncv2.imwrite(\n    \"demo-rgb.jpg\", result[\"image\"][..., ::-1]\n)  # transfer RGB image to opencv's BGR\n\n# save instance map as 16 bit png\ncv2.imwrite(\"demo-inst.png\", np.uint16(result[\"inst\"]))\n# the value of each pixel represents the inst_id of the object\n\n# convert depth units from meters to millimeters\ndepth_in_mm = result[\"depth\"] * 1000\ncv2.imwrite(\"demo-depth.png\", np.uint16(depth_in_mm))  # save as 16bit png\n\n# visualization instance mask, RGB, depth for human\ncv2.imwrite(\"demo-vis(inst_rgb_depth).jpg\", result.vis()[..., ::-1])\nprint(f\"Saving vis image to: 'demo-vis(inst_rgb_depth).jpg'\")\n```\nOpen `./demo-vis(inst_rgb_depth).jpg`:   \n\n![demo-vis(inst_rgb_depth)](https://user-images.githubusercontent.com/10448025/115022679-4ad8e480-9ef0-11eb-9a42-cdfbf7e9d2ae.jpg)\n\n#### 2. YCB Demo\n\n```shell\nmkdir ycb_demo\ncd ycb_demo/\n\n# prepare code and example data\ngit clone https://github.com/DIYer22/bpycv\ngit clone https://github.com/DIYer22/bpycv_example_data\n\ncd bpycv/example/\n\nblender -b -P ycb_demo.py\n\ncd dataset/vis/\nls .  # visualize result here\n# 0.jpg\n```\nOpen visualize result `ycb_demo/bpycv/example/dataset/vis/0.jpg`:   \n![0](https://user-images.githubusercontent.com/10448025/115022704-55937980-9ef0-11eb-952e-c85eb5fad4b8.jpg)    \n*instance_map | RGB | depth*\n\n[example/ycb_demo.py](example/ycb_demo.py) Inculding:\n- Domain randomization for background, light and distractor (from ShapeNet)\n- Codebase for building synthetic datasets base on YCB dataset\n\n#### 3. 6DoF Pose Demo\nGenerate and visualize 6DoF pose GT: [example/6d_pose_demo.py](example/6d_pose_demo.py)\n\n\u003cimg src=\"https://user-images.githubusercontent.com/10448025/74708759-5e3ee000-5258-11ea-8849-0174c34d507c.png\" style=\"width:300px\"\u003e\n\n\n## ▮ Tips\n \u003e Blender may can't direct load `.obj` or `.dea` file from YCB and ShapeNet dataset.  \n \u003e It's better to transefer and format using [`meshlabserver`](https://github.com/cnr-isti-vclab/meshlab/releases) by run `meshlabserver -i raw.obj -o for_blender.obj -m wt`\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cdiv align=\"center\"\u003e\n\n**[suggestion](https://github.com/DIYer22/bpycv/issues) and pull request are welcome** 😊\n\u003c/div\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiyer22%2Fbpycv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiyer22%2Fbpycv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiyer22%2Fbpycv/lists"}