DragonflyRobotics / DragonflyRobotics/MAGIST-Algorithm

Black regions of the clustered images causes Google Reverse Image Search to Fail

Đang mở
#12 0 bình luận 0 reaction 1 người được giao Được @DragonflyRobotics nhận Xem trên GitHub
bug help wanted
Ngôn ngữ chính
Python
Star
5
Fork
0
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Description**
The clustering algorithm leaves the parts of the masked images that aren't part of the clustered class black. This makes it incredibly hard for Google to classify them. Using some clever algorithm to remove these black spots can help a lot.

**To Reproduce**
Steps to reproduce the behavior:
1. Put this image in your script directory:
![image](https://user-images.githubusercontent.com/85193239/175091907-a0971307-1e52-4444-ade1-3f5689f24075.png)

2. Run this:
```python3
from MAGIST.Vision.UnsupervisedModels.img_cluster import RoughCluster

cluster = RoughCluster("config.json")

imgs = cluster.unsupervised_clusters(6, "Input.jpg", (150, 150), "Clusters")

from MAGIST.Utils.WebScraper.google import GoogleScraper

scraper = GoogleScraper("config.json")

labels = []

for i in imgs:
label = scraper.reverse_image_search(i)
labels.append(label)

print(labels)
```

**Expected behavior**
Ideally, it should mask out nearby, similar pixels but it doesn't. This leaves massive, unstructured black gaps that cause a lot of issues when reverse searching.

**Screenshots**
![image](https://user-images.githubusercontent.com/85193239/175092667-d53d902e-c2f9-486c-a252-efb83898ad83.png)

![image](https://user-images.githubusercontent.com/85193239/175092774-83e79f7d-26a9-4d15-b571-404ff14e6fb6.png)

**Additional context**
Google generally returns `language` or `night` when there is too much black. The solution would be something like this:
1. Find each masked image's edge pixels.
2. Compute all possible lines that can be formed from edge pixels.
3. Crop image at that line if all pixels in the line are black.

This is super computationally intensive, however.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.