Conversation
Replace torch/torchvision/torchmetrics with scikit-image and numpy/scipy implementations: - Use skimage.metrics.structural_similarity instead of torchmetrics SSIM - Replace piq BRISQUE with brisque package wrapper - Removes torch, torchvision, torchmetrics, piq dependencies (~3.5GB less) - Add brisque, scipy, scikit-image as replacements Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| ) | ||
| second_image_tensor = torch.tensor(data=second_image_np).float() / 255 | ||
| second_image_tensor = second_image_tensor.view( | ||
| second_image_resized.size[1], |
There was a problem hiding this comment.
SSIM fails on grayscale images missing channel dimension
High Severity
The structural_similarity call unconditionally passes channel_axis=2, but grayscale ("L" mode) images produce 2D numpy arrays with shape (H, W) — no axis 2 exists. The image validator explicitly allows grayscale images, so they can reach this code path. The old torch-based code handled this correctly via getbands() and .view(). The _brisque.py wrapper avoids this by calling .convert(mode="RGB"), but image_matchers.py does not convert images before creating numpy arrays.
- Dockerfile: install g++ so libsvm-official (brisque dep) can compile - Add 'brisque' to spelling private dictionary for pylint - Disable pylint no-name-in-module for skimage.metrics import Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>


Summary
Replace PyTorch and torchmetrics with lighter-weight alternatives:
torchmetrics.image.StructuralSimilarityIndexMeasurewithskimage.metrics.structural_similaritypiqBRISQUE implementation withbrisquepackage wrapperChanges
🤖 Generated with Claude Code
Note
Medium Risk
Replaces SSIM/BRISQUE implementations and swaps major dependencies, which may slightly change image matching/target rating behavior and introduces native build requirements in Docker.
Overview
Removes the PyTorch-based image-quality stack by dropping
torch,torchvision,torchmetrics, andpiq, and addingbrisque,scikit-image, andscipy(plus deleting the customuvPyTorch CPU index config).Updates
StructuralSimilarityMatcherto compute SSIM viaskimage.metrics.structural_similarityon normalized NumPy arrays, and rewires target tracking ratings to use a newmock_vws._brisque.brisque_scorewrapper around thebrisquepackage.Adjusts the Flask server Docker image to install
g++so native extensions needed by the new dependency chain can compile, and updates lint/dep tooling config and spelling dictionary accordingly.Written by Cursor Bugbot for commit 259c63b. This will update automatically on new commits. Configure here.