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

To cityscape format? #38

Closed Goooyi closed 2 years ago

Goooyi commented 2 years ago

Thanks for this work, I notice that bpycv support cityscape format, I want to ask is there a demo or doc to demonstrate how to save the results as cityscape format?

DIYer22 commented 2 years ago

Cityscapes style: Similar to *_instanceIds.png in Cityscapes dataset, those png file are Height Width 16bit. Each pixel value x means that the pixel belongs to the instance ID is x.

For instance ID x, the corresponding categories_id is x//1000. For example, instance ID 3002, means it's categories_id id is 3002//1000 = 3

Thus, you should set your object with object["inst_id"] = categories_id * 1000 + index Then

result = bpycv.render_data()
cv2.imwrite("demo-inst.png", np.uint16(result["inst"]))