galdric/README.md
README.mdRaw
1# galdric
2machine learning server, for image classification
3
4
5 - Reads all the datasets in the folder /dataset
6 - Runs a server that allows to upload images to classify
7 - Accepts PNG, JPG, JPEG
8 - Each image is resized to the same size and converted to PNG type, configured in the config.json
9 - For the input images, calculates the euclidean distances
10 - Applyies KNN (K-Nearest Neighbours algorithm) to classify the images
11 - Server returns the classification result, that is the label of the object in the image
12
13
14
15### Instructions
16
17Put dataset in /dataset directory with subdirectories, where each subdirectory contains images of one element.
18
19For example:
20```
21dataset/
22 leopard/
23 img01.png
24 img02.png
25 img03.png
26 ...
27 laptop/
28 img01.png
29 img02.png
30 ...
31 camera/
32 img01.png
33 img02.png
34 ...
35```
36So, we have each image and to which element category is (the name of subdirectory).
37
38
39Then, run the server:
40```
41 >./galdric
42```
43
44Now, just need to perform petitions with new images, to get the response from the server classifying them:
45```bash
46 curl -F file=@./testimage.png http://127.0.0.1:3055/image
47```
48And the server will return:
49```
50 seems to be a leopard
51```
52
53Can perform some tests with the test.sh file:
54```
55 bash test.sh
56```
57
58
59-------------
60#### Useful commands
61
62send file over ssh:
63```
64scp dataset.tar.gz root@SERVERIP:/root/galdric
65```
66
67on the server, untar file:
68```
69tar -xvzf dataset.tar.gz
70```