Skip to content

Sort the search results of Shotit to increase the correctness of Top1 result by using Keras and Faiss.

License

Notifications You must be signed in to change notification settings

shotit/shotit-sorter

Repository files navigation

Shotit-sorter

License Coverage GitHub Workflow Status GitHub release Docker Docker Image Size

Sort the search results of Shotit to increase the correctness of Top1 result by using Keras and Faiss.

Docker Guide:

> docker pull ghcr.io/shotit/shotit-sorter:v0.9.3

> docker run --name my-shotit-sorter -p 19532:19532 ghcr.io/shotit/shotit-sorter:v0.9.3

Local Development Guide:

> python -m venv venv

> cd venv/Scripts

> activate

> cd ../..

> python -m pip install -r requirements.txt

> python -m uvicorn main:app --port 19532

Restful API call:

POST http://127.0.0.1:19532/sort

parameters structure content-type
candidates {"candidates": [{"image": "url"}]} application/json
target Blob || Stream -

curl:

curl --location 'http://127.0.0.1:19532/sort' \
--form 'candidates="{
    \"candidates\": [
        {
            \"image\": \"https://i.ibb.co/JCj5T41/big-buck-bunny-1.png\"
        },
        {
            \"image\": \"https://i.ibb.co/HHJPP3R/big-buck-bunny-2.png\"
        },
        {
            \"image\": \"https://i.ibb.co/LPR0gb7/big-buck-bunny-3.png\"
        },
        {
            \"image\": \"https://i.ibb.co/qnwfks9/big-buck-bunny-4.png\"
        },
        {
            \"image\": \"https://i.ibb.co/56nvNHD/big-buck-bunny-5.png\"
        },
        {
            \"image\": \"https://i.ibb.co/jM3657F/big-buck-bunny-6.png\"
        },
        {
            \"image\": \"https://i.ibb.co/ZhDQshx/big-buck-bunny-7.png\"
        },
        {
            \"image\": \"https://i.ibb.co/0h5gD7y/big-buck-bunny-8.png\"
        },
        {
            \"image\": \"https://i.ibb.co/XV54Rk7/big-buck-bunny-9.png\"
        },
        {
            \"image\": \"https://i.ibb.co/KGwVkqy/big-buck-bunny-10.png\"
        }, 
        {
            \"image\": \"https://i.ibb.co/J7v6p24/big-buck-bunny-11.png\"
        }
    ]
}";type=application/json' \
--form 'target=@"/D:/yourpath/big-buck-bunny-10.png"'

The sorted result:

{
    result: [
        {
            "image": "https://i.ibb.co/KGwVkqy/big-buck-bunny-10.png"
        },        
        {
            "image": "https://i.ibb.co/qnwfks9/big-buck-bunny-4.png"
        },
        {
            "image": "https://i.ibb.co/HHJPP3R/big-buck-bunny-2.png"
        },
        {
            "image": "https://i.ibb.co/XV54Rk7/big-buck-bunny-9.png"
        },
        {
            "image": "https://i.ibb.co/ZhDQshx/big-buck-bunny-7.png"
        },        
        {
            "image": "https://i.ibb.co/0h5gD7y/big-buck-bunny-8.png"
        },
        {
            "image": "https://i.ibb.co/LPR0gb7/big-buck-bunny-3.png"
        },
        {
            "image": "https://i.ibb.co/J7v6p24/big-buck-bunny-11.png"
        },
        {
            "image": "https://i.ibb.co/56nvNHD/big-buck-bunny-5.png"
        },
        {
            "image": "https://i.ibb.co/jM3657F/big-buck-bunny-6.png"
        },
        {
            "image": "https://i.ibb.co/JCj5T41/big-buck-bunny-1.png"
        }        
    ]
}