This repository provides a pipeline for event recognition from photo albums. Given an album (a folder of images), it infers the type of event (e.g., Wedding, Graduation, Birthday) and highlights the most important images using an attention mechanism.
🧠 The focus of this project is on inference, using a pretrained attention-based deep learning model and CLIP + RAM features.
Given a folder of images (an album), this system:
- Extracts visual features from CLIP
- Extracts semantic tags using RAM (Recognize Anything Model)
- Combines both features and feed them into a pretrained attention model
- Outputs:
- Predicted event label(s) (multi-label)
- Top-N important images based on learned attention scores
git clone https://github.com/tqth/event-inference.git
cd event-inferencepip install -r requirements.txtThis project and its dependencies are currently tested and intended to run only on CPU environments. Running on GPU may cause unexpected errors or unstable behavior due to compatibility issues with some libraries.
This project includes a Jupyter Notebook (inference_event_demo.ipynb) that demonstrates a full inference pipeline from loading an album folder to predicting event labels and extracting important images.
🔍 Step-by-step
from predict_event import predict_event_and_top_n_images_from_folder
album_path = "/path/example_album"
event, key_images = predict_event_and_top_n_images_from_folder(album_path, n_key_images= 5)
print("Prediction:", event)
print("Key images:", key_images)🖼️ Example Output
Predict: ['Graduation']
Top 3 important images:
- 4785949094.jpg
- 4785955252.jpg
- 4785314023.jpg