hashsearch
v1.0.0

hashsearch - 使用感知哈希的反向圖像搜索。 ?Hashsearch是一種輕巧,易於使用的反向圖像搜索引擎,可利用感知哈希。
最簡單的方法是從發行版中下載。
您還可以從源代碼構建hashsearch :
git clone https://github.com/burntcarrot/hashsearch
cd hashsearch
go build -o ./bin/hashsearch api/v1/main.go hashsearch -config <CONFIG_FILE_PATH>
如果沒有提供-config ,則hashsearch默認為<HOME_DIR>/.hashsearch/config.yml 。
hashsearch運行服務器在配置的地址上,並公開與API進行交互。
API非常簡單。兩條路線,一條用於搜索,另一條用於獲取圖像列表。
/v1/search使用表單數據發布圖像,獲取圖像列表(至少對大多數距離進行排序):
curl --location --request POST ' localhost:8081/v1/search '
--form ' file=@"star.png" '回覆:
[
{
"path" : " files/star.png " ,
"distance" : 0 ,
"hash" : " 0000000000010000111100001111110011111100111100000001000000000000 "
},
{
"path" : " files/star-new.png " ,
"distance" : 4 ,
"hash" : " 0001000000110000111100001111110011111100111100000011000000010000 "
},
{
"path" : " files/random.png " ,
"distance" : 28 ,
"hash" : " 0000000110000000110000100010001111110010010001100000011110000110 "
}
]/v1/list獲取所有圖像的列表:
curl --silent 'localhost:8081/v1/list'
回覆:
[
{
"path" : " files/random.png " ,
"distance" : 0 ,
"hash" : " 0000000110000000110000100010001111110010010001100000011110000110 "
},
{
"path" : " files/star-new.png " ,
"distance" : 0 ,
"hash" : " 0001000000110000111100001111110011111100111100000011000000010000 "
},
{
"path" : " files/star.png " ,
"distance" : 0 ,
"hash" : " 0000000000010000111100001111110011111100111100000001000000000000 "
}
]配置文件是一個簡單的.yaml文件:
db :
url : " data.db " # Database URL.
server :
addr : " localhost:8081 " # Server address.
files :
dir : " /files " # Directory where the images would be saved.
cors :
allow_origin : " * " # CORS Allow-Origin value.
logging :
file : " /hashsearch.log " # Log file path. 您使用/v1/search路線上傳圖像:
hashsearch製作您的圖像的副本hashsearch將復製圖像存儲在FILES_DIR中,該圖像可配置hashsearch發布圖像時會生成哈希,並將其保存到數據庫hashsearch計算發布的圖像與其他圖像之間的距離,並作為JSON響應返回結果如果您有一個小規模的應用程序,並且不想使用大型依賴/系統,則可以正常工作。
是最好的解決方案嗎?不是真的,但是如果您想要一個快速簡便的解決方案,那應該足夠好。
燃燒快嗎?再次,不確定這一點;我沒有在大量圖像上測試過。
hashsearch已獲得MIT許可證的許可。
看起來這是該項目背後的靈感之一。
這不是在大多數領域實施反向圖像搜索的方式。我只是想在感知哈希上玩一些樂趣。
在大多數情況下,平均哈希是可以的,但是它在某些地區掙扎,因此更好的選擇是使用Dhash/phash。
我正在積極進行反向視頻搜索;期望它成為未來版本的一部分。
也很快就會添加一個不錯的網絡UI。