anuragxel / salt

Segment Anything Labelling Tool
MIT License
1.02k stars 126 forks source link

Pink line generated from the top left corner of the image #38

Open sai-chowdary opened 1 year ago

sai-chowdary commented 1 year ago

When I view the image, there is a pink line generated from the top left corner of the image. I tried to investigate the issue by printing variable "sc" from the file dataset_explorer.py, and I found a random value "6.91669498947497e-310, 6.91669498947497e-310" generated at the beginning. To overcome this issue, I added this line "sc = [x for x in sc if x > 0.1]" in the file dataset_explorer.py.

Screenshot:

Please refer to the attached screenshots for better understanding.

  1. Screenshot from 2023-05-02 15-36-22
  2. Screenshot from 2023-05-02 15-36-29

Expected Outcome:

The pink line should not be generated from the top left corner of the image.

Steps to Reproduce:

  1. Run segment_anything_annotator.py.
  2. Label any object.
  3. Select the label name and click on the save button, then click on the add button.
  4. The error will be found on the image.
edwardwterry commented 1 year ago

I grappled with this for a few hours. I started with your suggestion sc = [x for x in sc if x > 0.1] but realized it handled some cases differently, specifically when the actual coordinate is 0 (i.e. along the top or left borders). Instead I handled the entries one pair at a time. I added these lines after L90:

tol = 1e-3
cleaned = []
for x, y in zip(sc[::2], sc[1::2]):
    if x > tol and y > tol:
        cleaned.append(x)
        cleaned.append(y)
annotation["segmenation"].append(cleaned)

It's not particularly compact but it seems to do the job.

The pair of coordinates at the origin appears to be an artifact of the call to simplify_coords_vwp and I'm not sure if it is consistently the first pair of elements, so best to go through the full list.

threeneedone commented 1 year ago

当我查看图像时,从图像的左上角生成了一条粉红色的线。我试图通过从文件dataset_explorer.py打印变量“sc”来调查这个问题,我发现开始时生成的随机值“6.91669498947497e-310,6.91669498947497e-310”。为了克服这个问题,我在文件dataset_explorer.py中添加了这一行“sc = [x for x in sc if x > 0.1]”。

截图:

请参阅随附的屏幕截图以更好地理解。

  1. 截图来自 2023-05-02 15-36-22
  2. 截图来自 2023-05-02 15-36-29

预期成果:

粉色线不应从图像的左上角生成。

重现步骤:

  1. 运行segment_anything_annotator.py。
  2. 标记任何对象。
  3. 选择标签名称并单击保存按钮,然后单击添加按钮。
  4. 将在图像上找到错误。

it is also have some problem