How paragshah97/pixads-ai works
Main Components
• Frontend/UI: Represented by the Streamlit application that kicks off with master.py. This component handles user authentication (as seen in the README login credentials) and image upload.
• Model Inference Engine: Encompasses model_structure.py to define/create the models and the use of pre-trained weights from model_weights. Include sub-components for:
▪ Resnet
▪ Densenet (weights: densenet_final_project_75.pth)
▪ VGG13
▪ Alexnet (as mentioned in the README)
• Prediction Aggregation: Component for combining outputs from these models, represented by overall_pred.py, which selects the most confident prediction.
Relationships and Data Flow
• The user interacts with the Streamlit UI (master.py) to log in and upload images.
• The uploaded image moves into the preprocessing pipeline (using libraries such as Pillow and OpenCV).
• The preprocessed image is then sent into the model inference engine (with models defined in model_structure.py and weights loaded from model_weights).
• Each model makes a prediction and sends its output to overall_pred.py, which aggregates the results.
• The results (predicted class and advertisement) are then displayed back to the user via the Streamlit UI.
Architectural Patterns & Design Principles
• Separation of Concerns: Clear division between the UI layer (Streamlit) and the backend processing (model inference, prediction aggregation, advertisement selection).
• Modular Design: Each Python file (master.py, model_structure.py, overall_pred.py, advertisments.py) represents a modular component of the application.
• Extensibility: The architecture has natural extension points like adding more models or new advertisement selection strategies, which is important for a lab-style or real-world application.
Relevant Technologies, Frameworks, and Libraries
• Streamlit: For building the web-based application interface.
• PyTorch: For deep learning model implementation and inference.
• TorchVision: The likely source of the deep learning models.
• Pillow & OpenCV: For image processing.
• Pre-trained model weights: Stored in the model_weights directory.