- Access to
frontend
folder.
cd frontend
- Install dependencies.
npm install
- Start application.
npm start
- Python 3.x
- OpenCV
- NumPy
- scikit-image
- Tensorflow
You can install the required libraries using pip:
pip install -r requirements.txt
- Run fastapi
fastapi run main.py
Drag and drop image to the web and wait to get similar images.
This Python script calculates the similarity between a base image and a dataset of images using structural similarity and color histogram comparison. The results are sorted by similarity and saved to a JSON file.
- Utilizes structural similarity index (SSIM) and histogram comparison for similarity scoring.
- Caches processed images for efficiency.
- Outputs similarity scores in a JSON file, making it easy to use in further data processing.
- Clone the Repository:
git clone https://github.com/AnderVarela/HackUPC.git
cd HackUPC/scripts
- Prepare the Dataset:Place your dataset of images in the images directory.
- Configure the Script:Specify the path of your base image in the script.
Modify the script to correctly point to your image directory and the base image:
directory
: Path to the directory containing the image dataset.base_image_path
: Path to the base image against which other images are compared.
Run the script by navigating to the project directory and executing: If we want to use the AI model:
python AIsimilarity.py
If we just want to use the computer vision model:
python VAsimilarity.py
Apart from the versions to generate the JSON files, there is also a version to view the results using Matplotlib (shape&color)
python VAshape&color.py
```bash
python AIshape&color.py
The script processes the images and saves the similarity scores in similarity_scores.json in the current directory.
The output JSON file contains a list of filenames and their similarity scores, sorted from the most to the least similar to the base image.
Make sure the image paths and the output directory in the script match your setup. Adjust the image processing functions if needed to suit different image types or quality.