Documentation
Comprehensive guide to using the microplastics analysis tool
Input File Formats
Supported Image Formats
The tool accepts the following image file formats:
- JPEG/JPG — Joint Photographic Experts Group format (.jpg, .jpeg)
- PNG — Portable Network Graphics format (.png)
- TIFF/TIF — Tagged Image File Format (.tiff, .tif)
- BMP — Bitmap Image File (.bmp)
ZIP Archives
You can also upload a ZIP archive containing multiple image files. The archive will be extracted and all images within will be processed. This is useful for batch analysis of multiple samples.
Image Requirements
- Images should be captured using a microscope at appropriate magnification
- Particles should be clearly visible and in focus
- Adequate lighting and contrast are recommended for accurate classification
- No specific resolution requirements, but higher resolution generally improves accuracy
- Maximum file size per upload: 100MB
Algorithms and Models
Model Architecture
All models are based on EfficientNet-B0, a convolutional neural network architecture optimized for both accuracy and computational efficiency. The models were trained on a curated dataset of microscope images from the Wishart Lab microplastics research collection.
Shape Classification (Ensemble)
The shape classification task uses an ensemble of 5 EfficientNet-B0 models trained via 5-fold cross-validation. Each model was trained on a different fold of the dataset, and their predictions are averaged to produce the final result.
Classes: Fragment, Fiber, Film
Method: 5-fold cross-validation ensemble voting
Architecture: EfficientNet-B0 (5 models)
Fiber Detection
A binary classifier specifically trained to distinguish fiber morphology from non-fiber particles (fragments and films). This model provides specialized detection for fiber-shaped microplastics.
Classes: Fiber, Non-Fiber
Method: Single model binary classification
Architecture: EfficientNet-B0
Fiber vs Fragment Classification
This model specifically classifies particles as either fiber or fragment, excluding films from consideration. It is useful when the focus is on distinguishing these two common particle types.
Classes: Fiber, Fragment
Method: Single model with focal loss
Architecture: EfficientNet-B0
Size Classification
Predicts the size category of microplastic particles based on their visual characteristics. The classification follows standard microplastics size definitions:
Classes:
- MICRO: < 50µm
- MESO: 50µm - 500µm
- MACRO: 500µm - 5mm
- MEGA: > 5mm
Method: Single model classification
Architecture: EfficientNet-B0
Size Regression
A regression model that predicts the actual size of particles in micrometers (µm) rather than categorizing them. This provides continuous size estimates for more granular analysis.
Output: Size in micrometers (log-transformed)
Method: Single model regression
Architecture: EfficientNet-B0
Microplastic Detection
A binary classifier that determines whether an image contains microplastics or not. This can be used to filter out images that do not contain relevant particles.
Classes: Microplastic Present, Microplastic Absent
Method: Single model binary classification
Architecture: EfficientNet-B0
Output Files
Results Table
After analysis, a results table is displayed showing predictions for each uploaded image. The table includes:
- Filename: Name of the uploaded image
- Thumbnail: Clickable preview of the image
- Shape: Predicted shape class (Fragment/Fiber/Film)
- Confidence: Model confidence score for shape prediction
- Fiber: Fiber detection result (Yes/No)
- Size Class: Predicted size category
- Size (µm): Predicted size in micrometers
- Status: Processing status (Success/Error)
Download Formats
Results can be downloaded in two formats:
- CSV (Comma-Separated Values) — Plain text format suitable for spreadsheet applications, data analysis tools, and custom scripts
- XLSX (Excel) — Microsoft Excel format with formatting preserved, suitable for Excel users and presentations
Run ID
Each analysis session is assigned a unique run ID (timestamp-based). This ID is used to identify the analysis session and can be used to retrieve results via the URL or for record-keeping purposes.
Error Handling
If an image fails to process (e.g., corrupted file, unsupported format), it will be marked with an error status in the results table. Error messages provide details about the failure reason.
Usage Guidelines
Best Practices
- Use images captured at consistent magnification for best results
- Ensure particles are well-lit and in focus
- Include a scale bar in images if size estimation is critical
- Process images in batches using ZIP archives for efficiency
- Review predictions and validate with expert knowledge when possible
Limitations
- Models were trained on a specific microscope dataset; performance may vary with different imaging conditions
- Predictions are experimental and should not be used as the sole basis for scientific conclusions
- Size estimates are based on visual characteristics and may not be as accurate as direct measurement
- Very small or very large particles outside the training distribution may be misclassified
API Endpoints
Health Check
Endpoint: /health
Method: GET
Description: Returns JSON status of the service and model availability
Response:
{
"status": "ok",
"service": "microplastics-webserver",
"version": "0.1.0",
"models": {
"all_required_available": true,
"available": ["shape_ensemble", "fiber_binary", ...],
"unavailable": []
}
}
Model Status
Endpoint: /models
Method: GET
Description: Returns detailed information about all registered models and their checkpoint availability