DIYer22 / bpycv

Computer vision utils for Blender (generate instance annoatation, depth and 6D pose by one line code)
MIT License
464 stars 58 forks source link

Rendering both semantic & instance segmentation maps #32

Closed AvivSham closed 2 years ago

AvivSham commented 2 years ago

Hi All, I saw on other issue how to render semantic segmentation maps by basically change obj["inst_id"] to object_class_id instead of object_id. Is it possible to render both semantic segmentation and instance segmentation in one rendering action?

As a workaround we can obtain the maps with 2 rendering steps:

The procedure above is inefficient as we need to render the scene twice. How can we solve this? (maybe use another filed in obj for class_id?)

DIYer22 commented 2 years ago

By setting obj["inst_id"] as object_class_id * 1000+ object_id, then:

semantic_map = result["inst"] // 1000 instance_map = result["inst"] % 1000