Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/DLR-RM/BlenderProc into iss…
Browse files Browse the repository at this point in the history
…_356_bop_update
  • Loading branch information
MartinSmeyer committed Nov 27, 2021
2 parents f895370 + ac97e4a commit 7907269
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 200 deletions.
5 changes: 5 additions & 0 deletions .clabot
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"contributors": ["MartinSmeyer", "themasterlink", "cornerfarmer", "wboerdijk", "MarkusKnauer", "maximilianmuehlbauer", "wangg12", "alexander-soare", "heilaw", "wboerdijk"],
"message": "For contributing to BlenderProc you need to sign our Contributor License Agreement. As an individual please sign [CLA_individuals.pdf](https://github.com/DLR-RM/BlenderProc/blob/main/CLA_individuals.pdf), as a company please sign [CLA_entities.pdf](https://github.com/DLR-RM/BlenderProc/blob/main/CLA_entities.pdf) and send it to [email protected]",
"label": "cla-signed"
}
13 changes: 13 additions & 0 deletions .github/workflows/blenderprochelper.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: BlenderProcHelper

on: [push, pull_request, workflow_dispatch]

jobs:
Run-BlenderProcHelper:
runs-on: [self-hosted]
strategy:
max-parallel: 1
steps:
- uses: actions/checkout@v2
- name: Run BlenderProcHelper
run: python /home/$USER/workspace/BlenderProcHelper/github_action.py
Binary file added CLA_entities.pdf
Binary file not shown.
99 changes: 0 additions & 99 deletions CLA_entities.rst

This file was deleted.

Binary file added CLA_individuals.pdf
Binary file not shown.
90 changes: 0 additions & 90 deletions CLA_individuals.rst

This file was deleted.

10 changes: 5 additions & 5 deletions README_BlenderProc4BOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ The cameras are positioned to cover the distribution of the ground-truth object

## Examples

* [bop_challenge](datasets/examples/datasets/bop_challenge): Configuration files and information on how the official synthetic data for the BOP Challenge 2020 were created.
* [bop_object_physics_positioning](datasets/examples/datasets/bop_object_physics_positioning): Drops BOP objects on a plane and randomizes materials.
* [bop_object_on_surface_sampling](datasets/examples/datasets/bop_object_on_surface_sampling): Samples upright poses on a plane and randomizes materials.
* [bop_scene_replication](datasets/examples/datasets/bop_scene_replication): Replicates test scenes (object poses, camera intrinsics and extrinsics) from the BOP datasets.
* [bop_object_pose_sampling](datasets/examples/datasets/bop_object_pose_sampling): Loads BOP objects and samples the camera, light poses and object poses in a free space.
* [bop_challenge](examples/datasets/bop_challenge): Configuration files and information on how the official synthetic data for the BOP Challenge 2020 were created.
* [bop_object_physics_positioning](examples/datasets/bop_object_physics_positioning): Drops BOP objects on a plane and randomizes materials.
* [bop_object_on_surface_sampling](examples/datasets/bop_object_on_surface_sampling): Samples upright poses on a plane and randomizes materials.
* [bop_scene_replication](examples/datasets/bop_scene_replication): Replicates test scenes (object poses, camera intrinsics and extrinsics) from the BOP datasets.
* [bop_object_pose_sampling](examples/datasets/bop_object_pose_sampling): Loads BOP objects and samples the camera, light poses and object poses in a free space.


## Results
Expand Down
3 changes: 2 additions & 1 deletion blenderproc/python/camera/CameraValidation.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ def visible_objects(cam2world_matrix: Union[Matrix, np.ndarray], sqrt_number_of_
# Send ray from the camera position through the current point on the plane
_, _, _, _, hit_object, _ = bpy.context.scene.ray_cast(bpy.context.evaluated_depsgraph_get(), position, end - position)
# Add hit object to set
visible_objects.add(MeshObject(hit_object))
if hit_object:
visible_objects.add(MeshObject(hit_object))

return visible_objects

Expand Down
9 changes: 5 additions & 4 deletions blenderproc/python/writer/CocoWriterUtility.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def write_coco_annotations(output_dir: str, instance_segmaps: Optional[List[np.n
mask_encoding_format: str = "rle", supercategory: str = "coco_annotations",
append_to_existing_output: bool = True, segmap_output_key: str = "segmap",
segcolormap_output_key: str = "segcolormap", rgb_output_key: str = "colors",
jpg_quality: int = 95, label_mapping: LabelIdMapping = None):
jpg_quality: int = 95, label_mapping: LabelIdMapping = None, file_prefix: str = ""):
""" Writes coco annotations in the following steps:
1. Locate the seg images
2. Locate the rgb maps
Expand Down Expand Up @@ -49,6 +49,7 @@ def write_coco_annotations(output_dir: str, instance_segmaps: Optional[List[np.n
:param jpg_quality: The desired quality level of the jpg encoding
:param label_mapping: The label mapping which should be used to label the categories based on their ids.
If None, is given then the `name` field in the csv files is used or - if not existing - the category id itself is used.
:param file_prefix: Optional prefix for image file names
"""
if instance_segmaps is None:
instance_segmaps = []
Expand Down Expand Up @@ -124,19 +125,19 @@ def write_coco_annotations(output_dir: str, instance_segmaps: Optional[List[np.n
color_bgr[..., :3] = color_bgr[..., :3][..., ::-1]

if color_file_format == 'PNG':
target_base_path = 'images/{:06d}.png'.format(frame + image_offset)
target_base_path = 'images/{}{:06d}.png'.format(file_prefix, frame + image_offset)
target_path = os.path.join(output_dir, target_base_path)
cv2.imwrite(target_path, color_bgr)
elif color_file_format == 'JPEG':
target_base_path = 'images/{:06d}.jpg'.format(frame + image_offset)
target_base_path = 'images/{}{:06d}.jpg'.format(file_prefix, frame + image_offset)
target_path = os.path.join(output_dir, target_base_path)
cv2.imwrite(target_path, color_bgr, [int(cv2.IMWRITE_JPEG_QUALITY), jpg_quality])
else:
raise Exception('Unknown color_file_format={}. Try "PNG" or "JPEG"'.format(color_file_format))

else:
source_path = rgb_output["path"] % frame
target_base_path = os.path.join('images', os.path.basename(rgb_output["path"] % (frame + image_offset)))
target_base_path = os.path.join('images', file_prefix + os.path.basename(rgb_output["path"] % (frame + image_offset)))
target_path = os.path.join(output_dir, target_base_path)
shutil.copyfile(source_path, target_path)

Expand Down
Loading

0 comments on commit 7907269

Please sign in to comment.