You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.5 KiB

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