lxtGH / OMG-Seg

OMG-LLaVA and OMG-Seg codebase [CVPR-24 and NeurIPS-24]
Other
1.32k stars 50 forks source link

image_demo.py #45

Closed hcscysh closed 2 months ago

hcscysh commented 2 months ago

In the image_demo.py,the result is panoramic segmentation. If I want to chose unique label to perform instance segmentation,for example, I chose cars or people,how I can get the mask.

lxtGH commented 2 months ago

@HarborYuan Please check this problem.

HarborYuan commented 2 months ago

Hi @hcscysh ,

Thanks for your interest in our work.

To segment a specific category, you can first modify the class name dictionary here: https://github.com/lxtGH/OMG-Seg/blob/c1398d814e79e3def392c62a08b433bad51e2f8b/demo/configs/names/th139_st101.py#L1

CLASSES and THING_CLASSES should be your category, and STUFF_CLASSES should be [].

Then, you can re-generate the class embedding and run the demo again following the README here:

https://github.com/lxtGH/OMG-Seg/tree/main/demo

If you encounter any problems, feel free to let me know.

Best, @HarborYuan

hcscysh commented 2 months ago

Thanks for your reply, The question is solved. I want to convert the model to onnx,but the data preprocessing and postprocessing is a littlte difficulty, how can I get the easy way to process the data including preprocessing and postprocessing. inputs = pipeline(dict( img_path=IMG_PATH )) for key in inputs: inputs[key] = inputs[key].to(device=device)

inputs = default_collate([inputs])