This repository provides a framework for analysis based on visual data. The current implementation is set up for sentiment analysis from a sequence of images of a face, assigning a sentiment score (percentages for Angry, Disgust, Fear, Happy, Sad, Surprise, and Neutral) using the fer library by Justin Shenk. The tool outputs an Excel file with the image name, emotion percentages, and the dominant emotion.
This tool is designed to be used with data collected from the RPi Data Collection repository, also available on GitHub.
Visual_Analysis_Tool
├── main.py # Entry point of the application
├── requirements.txt # Project dependencies
├── .gitignore # Files and directories to ignore in Git
├── example_images # Folder with example images
├── example_results.xlsx # Example results from running the example images
└── README.md # Project documentation
-
Clone the repository:
git clone https://github.com/hleve/Visual_Analysis_Tool -
Navigate to the cloned directory:
cd Visual_Analysis_Tool -
Create a virtual environment:
python -m venv venv -
Activate the virtual environment:
On Windows:
venv\Scripts\activateOn macOS and Linux:
source venv/bin/activate -
Install the required dependencies:
pip install -r requirements.txt -
Run the python file:
python main.py
You can specify the image folder and output file path using either command-line arguments or a configuration file (config.yaml).
Edit the config.yaml file in the project root:
# config.yaml example
image_folder: ./example_images
output_file: ./example_results.xlsxThen simply run:
python main.py
You can also specify options directly:
python main.py --image_folder ./my_images --output_file ./results.xlsx
If the output file already exists, the script will automatically create a new file with an incremented name (e.g., results_1.xlsx).
The application will generate an Excel file containing the image names and their corresponding sentiment scores. The output file name will not overwrite previous results.
-
Place your images in a designated directory.
-
Navigate to the designated directory
-
Update the image directory path in
main.py. -
Update the output directory path in
main.py. -
Run the application:
python main.py
The application will generate an Excel file containing the image names and their corresponding sentiment scores.
Feel free to submit issues or pull requests for improvements or bug fixes.
This project is licensed under the MIT License. Details can be found in the LICENSE file.