This app takes an image and transforms it into a new image, containing the original colors of the input image, but organized by color. The process is based on the self-organizing maps algorithm by Teuvo Kohonen.
Input
Output
Input
Output
Large images take a long time to process, because they contain a huge amount of pixels. Therefore, a tool is included to resize the images.
-
The first argument provides a path to a directory with one or more images.
-
The second argument sets the desired amount of total pixels in the resized image.
$ python -m src.som.tooling.resize
e.g.:
$ python -m src.som.tooling.resize ~/Desktop/images <pixels>
Execute generation process with CLI command
$ python -m src.som.api.views.cli <blueprint-json-path>
The project is comprised of two main components: an API and Celery for processing. It is designed to be deployed to AWS and can be interacted with through the API to process images.
- API: The entry point for interacting with the project.
- Celery: Used for processing images.
- SQS: Used for queue management in Celery.
- A user makes a request to the API to process an image.
- The API offloads the processing to Celery.
- Celery processes the image and stores the result in an S3 bucket.
- Once processing is complete, the API sends an email with a link to the result.
An example of a request can be found in the quickstart
folder.
- Run pre-commit install to install the pre-commit hook
- Implementation based on an article by Mehreen Saeed:
- Orignial algorithm by Teuvo Kohonen: