How ranjeetkumar18/nst-style-image-generator works
This repository is a Flask-based neural style-transfer application, with a separate script for training its decoder. The main user workflow accepts content and style images plus an alpha value, encodes both images, applies adaptive instance normalization, decodes the blended features, saves the stylized image, and renders it for the user. A separate training workflow loads image datasets and trains the decoder. The training checkpoint expected by the web app is not present in the supplied tree; the graph shows only the VGG weights file that is present. Source excerpts support the shown calls; the README is empty.
Main entry points: train.py Training loop · app.py Flask routes · models.py VGG encoder · utils.py AdaIN utilities
Components 16
Web application
- Flask routes
app.py - Image form
app.py - Result page
templates/index.html
Style transfer
- Inference pipeline
app.py - VGG encoder
utils/models.py - AdaIN utilities
utils/utils.py - Image decoder
utils/models.py
Decoder training
- Training loop
train.py - Image dataset
utils/utils.py - Training transforms
utils/utils.py - Feature losses
train.py
Image assets
- Upload storage
static/uploads - Example images
examples - VGG weights
vgg_normalised.pth - Training outputs
Other components
- User
Connections 18
- User → Flask routes: submits images
app.py - Flask routes → Image form: validates form
app.py - Flask routes → Upload storage: saves and reads
app.py - Flask routes → Inference pipeline: runs transfer
app.py - Inference pipeline → VGG encoder: encodes images
app.py - Inference pipeline → AdaIN utilities: normalizes features
app.py - Inference pipeline → Image decoder: decodes features
app.py - VGG encoder → VGG weights: loads weights
utils/models.py - Flask routes → Result page: renders result
app.py - User → Flask routes: requests images
app.py - Flask routes → Example images: serves examples
app.py - Training loop → Image dataset: loads images
train.py - Training loop → Training transforms: builds transforms
train.py - Training loop → VGG encoder: extracts features
train.py - Training loop → Image decoder: trains decoder
train.py - Training loop → AdaIN utilities: computes feature statistics
train.py - Training loop → Feature losses: computes losses
train.py - Training loop → Training outputs: saves checkpoints
train.py