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 brach-assignment-bp-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 | |
|---|---|---|---|
| brach_assignment_bp_2026-0.1.0.tar.gz | 41.4 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| brach_assignment_bp_2026-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 82.8 MB
Release files / brach_assignment_bp_2026-0.1.0.tar.gz
| Download URL | brach_assignment_bp_2026-0.1.0.tar.gz |
|---|---|
| Size | 41.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e26738cb83c12c2455693e85bb0e992ba963d42ab54155733e53af0c522f856
|
|
BLAKE2b-256 checksum How to use checksums |
807c77520e28a62e95e13252a29b8630855db78ab632ea280c999cdcaff2bb21
|
| 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 / brach_assignment_bp_2026-0.1.0-py3-none-any.whl
| Download URL | brach_assignment_bp_2026-0.1.0-py3-none-any.whl |
|---|---|
| Size | 41.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f0c658e114479659f639efc5b577e9b01a1d5803fea8d4e206cb7f2888825bfd
|
|
BLAKE2b-256 checksum How to use checksums |
2fdd6e6496411c64d23a98834ff9a24da7fc774549dcb7fba9b51c53b520e5df
|
| 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}
|