Coder Social home page Coder Social logo

trendingtechnology / imgsmlr-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jie123108/imgsmlr-server

0.0 1.0 0.0 1.52 MB

Image search service. image search by image. 图片搜索服务. 相似图搜索

License: MIT License

Python 82.10% HTML 17.90%

imgsmlr-server's Introduction

imgsmlr-server

Image search service based on imgsmlr extension of PostgreSQL. Support image search by image.

This is a sample application of imgsmlr. It can be extended as appropriate and applied to the following scenarios:

  • Image and video work similarity detection
  • Illegal image filtering service.
  • Searching original video by video clip, video gif, video screenshot.

Reference

Run

Download source code

git clone https://github.com/jie123108/imgsmlr-server
cd imgsmlr-server

Init database

Start by docker-compose
docker-compose up -d

If you want to install and start the database yourself, please follow the online tutorial to install the imgsmlr extension. And use scripts/imgsmlr_init.sql to initialize the database.

access the database
docker exec -ti imgsmlr-server_postgres_1 psql -U imgsmlr -d imgsmlr

Start the server

pip install -r requirements.txt
python img-smlr-server.py

If the default configuration does not start properly. Please modify the configuration in config.py according to the actual situation.

Test

Add images

Adding images, currently only image URLs are supported. The more images the better. You can add them with the following command:

curl http://127.0.0.1:8140/imgsmlr/mgr/add -d '{"url": "http://host:port/image-file.jpg"}'

Tip: If you have already downloaded the image locally, you can start an nginx or python (python3 -m http.server) to turn the image into a URL.

Search by image

Request
curl 'http://127.0.0.1:8140/imgsmlr/search' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -d '{"url":"http://host:port/search-image.jpg"}'
Response
{
    "code": 200,
    "data": {
        "images": [
            {
                "dataId": null,
                "id": 212,
                "md5": "a230afeb27358888606f3105bfd05195",
                "meta": null,
                "remark": null,
                "simr": 0,
                "url": "http://host:port/image1.jpg"
            },
            {
                "dataId": null,
                "id": 205,
                "md5": "ce1321185d4b1318835775d04783c0c2",
                "meta": null,
                "remark": null,
                "simr": 1.06304,
                "url": "http://host:port/image2.jpg"
            },
            {
                "dataId": null,
                "id": 556,
                "md5": "f1e2c4f1cad7ef80fb16fe87623d4f82",
                "meta": null,
                "remark": null,
                "simr": 1.881019,
                "url": "http://host:port/image3.jpg"
            },
            ...
        ]
    },
    "msg": "OK"
}

Test Page

You can test the image search function by visiting http://127.0.0.1:8140/imgsmlr/.

Screenshot of test page
./docs/imgs/demo-p1.png
demo-p1
./docs/imgs/demo-p2.png
demo-p2
./docs/imgs/demo-p3.png
demo-p3

LICENSE

MIT

imgsmlr-server's People

Contributors

jie123108 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.