Vision Model Package: ResNet18 Wrapper
This package provides a simple, production-ready interface for image classification using a pretrained ResNet18 model. It is designed to be easily installable and used for quick inference tasks.
Installation
The package can be installed via pip:
pip install Dmytro-Shapovalov-brach-assignment-2026
Quick Start
from my_package import ModelWrapper
# Initialize the model (weights are loaded automatically)
inferer = ModelWrapper()
# Run prediction
img_path = "test_image.jpg"
predict = inferer.predict(img_path)
print(f"Predicted Class Index: {predict}")
API reference
-
ModelWrapper(model_path=None)
The main class for managing the model and inference.
model_path: Optional path to a custom .pth file. If None, it automatically loads the weights.pth bundled with the package.
-
ModelWrapper.predict(image_path)
Performs the full inference pipeline on a single image.
Input: str path to the image file.
Returns: int representing the predicted class index.
Process: Handles image loading (PIL), resizing (224x224), normalization (ImageNet stats), and tensor conversion (Torch)
Evaluation Proposal
To evaluate this model on a specific image classification task, I would use a standard validation pipeline to evaluate both accuracy and robustness.
-
Dataset: A separate test set relevant to the task.
-
Metrics:
Accuracy: measures the percentage of correct predictions.
F1-Score: evaluates performance across potentially imbalanced classes.
Inference Latency: measures the average time taken for a single prediction.
-
Pipeline:
Data Loading: using torchvision.datasets and DataLoader feed images in batches.
Inference Mode: setting the model to .eval() and using torch.no_grad() to disable gradient calculation and save memory.
Comparison: comparing predicted indices against ground truth labels to generate a confusion matrix.
Reporting: aggregating results to identify specific classes where the model might be underperforming.
-
Evaluation Pseudocode:
model.eval() results = [] with torch.no_grad(): for images, labels in test_loader: outputs = model(images) preds = torch.argmax(outputs, dim=1) results.extend((preds == labels).tolist()) accuracy = sum(results) / len(results) print(f"Test Accuracy: {accuracy:.2%}")
Release files for Dmytro-Shapovalov-brach-assignment-2026 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dmytro_shapovalov_brach_assignment_2026-0.1.0.tar.gz | 41.4 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dmytro_shapovalov_brach_assignment_2026-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 82.8 MB
Release files / dmytro_shapovalov_brach_assignment_2026-0.1.0.tar.gz
| Download URL | dmytro_shapovalov_brach_assignment_2026-0.1.0.tar.gz |
|---|---|
| Size | 41.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5da2e17d80b42af916519cb538bb00a469818931848df0c35b0ec159489a1f28
|
|
BLAKE2b-256 checksum How to use checksums |
ec1cffdbd2bd22515a6bc9aa6e4db557de021cb8c169bd1f2fa6a0745379f97b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / dmytro_shapovalov_brach_assignment_2026-0.1.0-py3-none-any.whl
| Download URL | dmytro_shapovalov_brach_assignment_2026-0.1.0-py3-none-any.whl |
|---|---|
| Size | 41.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d7800b0c1cbb030dc455be7fa60032871ab91c0d9e2e33b2770026711fb68b5
|
|
BLAKE2b-256 checksum How to use checksums |
e8bed0b82932c7d27b6e539d64ad9c05850abc2766e91b3aa1feb0c073f09384
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|