summaryrefslogtreecommitdiff
path: root/README.md
blob: 2cbc5f62240aede89ea5891058f5fd3ba07370f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# VFRAME Check API

VFRAME Check API Service


## Quick Start

- Install Python 3.x (use Miniconda or your choice)
- Install nginx, MySQL

```
apt install git nginx mysql-server mysql-client
mysql_secure_installation
mysql -r root
```

Create MySQL user:

```
CREATE DATABASE vframe_check;
CREATE USER 'vframe_check'@'localhost' IDENTIFIED BY 'some_new_password';
GRANT ALL PRIVILEGES ON vframe_check.* to 'vframe_check'@'localhost';
```

Clone the repo and add a .env file:

```
DB_HOST=localhost
DB_NAME=vframe_check
DB_USER=vframe_check
DB_PASS=some_new_password
```

### Endpoints

#### POST /v1/match

Check if an image is in the database.  If no images are found within the threshold, this image will be added to the database.

Form parameters:

- `threshold` (default: 6) - Minimum similarity threshold.  This is the Hamming distance used for phash comparisons.
- `limit` (default: 1) - Number of results to return.
- `url` - Image URL to fetch and test (will be stored if `add` is true)
- `q` (file) - Uploaded file to test (will not be stored)

#### POST /v1/similar

Find similar images to a query image.

Form parameters:

- `threshold` (default: 20) - Minimum similarity threshold.
- `limit` (default: 10) - Number of results to return.
- `url` - Image URL to fetch and test (will be stored if `add` is true)
- `q` (file) - Uploaded file to test (will not be stored)


### Importing files

The initial dataset can be hosted locally for now - make sure files are accessible inside `check/static/`.  These paths will be added directly to the dataset.

```
python cli_phash.py import -i 'static/sample_set_test_01/images/*'
```