kadirnar / segment-anything-video

MetaSeg: Packaged version of the Segment Anything repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SegAutoMaskPredictor producing random color

cnut1648 opened this issue · comments

Hello, first of all, thank you for this awesome works!

I am following the instruction in the README for SegAutoMaskPredictor, specifically this one:

# For video
results = SegAutoMaskPredictor().video_predict(
    source="video.mp4",
    model_type="vit_l", # vit_l, vit_h, vit_b
    points_per_side=16,
    points_per_batch=64,
    min_area=1000,
    output_path="output.mp4",
)

on my private mp4 data. However I note that although the segment seems prefect, they often change color between frames. For example a chair was red in last frame but green in the next frame. I wonder is there any way to enforce color consistency between frames? Any pointer will be appreciated!

I met the same question (issue #91). Now I have changed my method. There are two ways for you to consider.
First, try another segment model. For me, I tried mask2former.
Second, you can consider something like detr or Hungarian algorithm to fix the color of the object. But I haven't tried yet.