-
I'm new, I read the document, I simply changed the last sentence of the sample code: # bproc.renderer.enable_segmentation_output(map_by=["category_id", "instance", "name"])
bproc.renderer.enable_segmentation_output(map_by=["instance"])
# render the whole pipeline
data = bproc.renderer.render()
# write the data to a .hdf5 container
#bproc.writer.write_hdf5(args.output_dir, data)
# Try write the data to coco format
bproc.writer.write_coco_annotations(args.output_dir,
instance_segmaps=data['instance_segmaps'],
instance_attribute_maps=None,
colors=data['colors'],
color_file_format='PNG',
mask_encoding_format='rle',
supercategory='coco_annotations',
append_to_existing_output=True,
segmap_output_key='segmap',
segcolormap_output_key='segcolormap',
rgb_output_key='colors',
jpg_quality=95,
label_mapping=None,
file_prefix='') I don't know how to deal with instance_segmaps=data['instance_segmaps'],
instance_attribute_maps=None,
colors=data['colors'],
color_file_format='PNG',
mask_encoding_format='rle',
supercategory='coco_annotations',
append_to_existing_output=True,
segmap_output_key='segmap',
segcolormap_output_key='segcolormap',
rgb_output_key='colors',
jpg_quality=95,
label_mapping=None,
file_prefix='') the result was not what I expected. Error: Python: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\coding\python_learning\BlenderProc-main\examples/basics/semantic_segmentation/main.py", line 44, in <module>
bproc.writer.write_coco_annotations(args.output_dir,
File "C:\Users\NowLoadY\.conda\envs\blenderproc\lib\site-packages\blenderproc\python\writer\CocoWriterUtility.py", line 87, in write_coco_annotations
raise RuntimeError(f"There is no output registered with key {segcolormap_output_key}. Are you sure you "
RuntimeError: There is no output registered with key segcolormap. Are you sure you ran the SegMapRenderer module with 'map_by' set to 'instance' before? Could anyone please tell me what to do, I would be very grateful.💌 |
Beta Was this translation helpful? Give feedback.
Answered by
NowLoadY
Dec 27, 2022
Replies: 2 comments
-
Solved, instead of using: # activate depth rendering
bproc.renderer.enable_depth_output(activate_antialiasing=False)
# enable segmentation masks (per class and per instance)
bproc.renderer.enable_segmentation_output(map_by=["category_id", "instance", "name"]) I should use: # activate normal rendering
bproc.renderer.enable_normals_output()
# enable segmentation masks (per class and per instance)
bproc.renderer.enable_segmentation_output(map_by=["category_id", "instance", "name"]) 😀 # Write data to coco file
bproc.writer.write_coco_annotations(args.output_dir,
instance_segmaps=data['instance_segmaps'],
instance_attribute_maps=data["instance_attribute_maps"],
colors=data['colors'],
color_file_format="JPEG",
segmap_output_key='segmap',
segcolormap_output_key='segcolormap',
rgb_output_key='colors',
label_mapping=None) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
cornerfarmer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Solved, instead of using:
I should use:
😀
and refer to examples/advanced/main.py: