Interface orchestration
Stepwise pipeline state
The frontend treats each pipeline step as an executable stage with
its own endpoint, input contract, artifact dependency, running
state, and result renderer. This lets viewers inspect raw input,
intermediate artifacts, and final predictions without rerunning
completed stages.
Image normalization
ArUco-guided wing crop
OpenCV detects ArUco markers after grayscale conversion,
morphological closing, and thresholding. Marker geometry defines a
reproducible crop region, preserving scale cues before the image
is passed into the deep learning and geometry pipelines.
ResNet pipeline
Segmentation plus CNN inference
A Keras U-Net isolates the wing from the card background, keeps
the largest predicted contour, centers the crop around the wing
centroid, and resizes it for a fine-tuned PyTorch ResNet50 species
classifier. The API returns top-k softmax probabilities.
Geometry pipeline
Marginal-cell retrieval
A ResNet50-encoder segmentation model extracts venation structure.
Candidate contours are filtered by area, perimeter ratio, edge
contact, and solidity, then a Transformer-based boundary
classifier identifies the marginal cell used for shape analysis.
Shape model
Fourier descriptor classification
The marginal-cell contour is traced, resampled to a fixed-length
closed boundary, converted into normalized Fourier descriptors,
reduced with PCA, and classified with a gradient-boosting model.
This path exposes interpretable morphology alongside CNN results.
Deployment boundary
Notebook to API service
Model checkpoints are loaded behind Flask endpoints that exchange
uploaded files and generated artifact IDs. The Dockerized backend
separates inference from the static frontend, making the demo
deployable while keeping the UI responsive to long-running steps.