Requisites
The required dependencies are installed in the Dockerfile.
Installation
pip install pcr-framework
This will automatically install most dependencies.
Important: GDAL is not installed automatically via pip.
conda install -c conda-forge gdal
Usage
You can run the provided test script to check the library:
python pcr_framework/test/pcr_framework_test.py
Main features
Load and manage data
Load and manage datasets, annotations, images, and video sequences. The library provides a unified data representation for different computer vision tasks.
import numpy as np
from pcr_framework.src.annotations import GenericVideo, GenericImage
# Prepare annotations and predictions.
# GenericVideo represents a set of images or a sequence of frames from a video
# for solving a generic computer vision problem.
ann, pred = GenericVideo(), GenericVideo()
# For example, you can split an image into smaller tiles (regions of interest)
# and process each part separately.
for roi in [[0, 0, 600, 600], [0, 600, 600, 1200], [0, 1200, 600, 1800]]:
img_pred = GenericImage('pcr_framework/test/example.tif')
img_pred.tile = np.array(roi)
pred.add_image(img_pred)
import tempfile
from tqdm import tqdm
from datasets import load_dataset
from pcr_framework.src.datasets import Database, Sources
# Annotations can be loaded directly or through the built-in dataloaders
# (src/datasets.py), which support multiple data sources and formats,
# including TXT files, TensorFlow datasets, and Hugging Face datasets.
datasets = [subclass().get_names() for subclass in Database.__subclasses__()]
idx = next((idx for idx, subset in enumerate(datasets) if 'mnist' in subset), None)
anns = []
path = tempfile.gettempdir()
kwargs = {'path': 'ylecun/mnist', 'cache_dir': path, 'split': 'test', 'download_mode': 'force_redownload'}
ds = load_dataset(**kwargs)
for line in tqdm(ds, file=sys.stdout):
ann = Database.__subclasses__()[idx]().load_line(Sources.HUGFACE, 'mnist', path, line)
if len(ann.images) == 0:
continue
anns.append(ann)
Integrate and execute computer vision components
Load, configure, and execute different computer vision modules through a unified interface. These components include object detection, segmentation, classification, regression, reconstruction, and other vision-related tasks.
from pcr_framework.src.composite import Composite
from pcr_framework.detection.ssd16_detection.src.ssd16_detection import SSD16Detection
# Composite class acts as a container where you can plug in different computer
# vision modules such as detectors, segmentators, regressors, classifiers, etc.
composite = Composite()
sd = SSD16Detection('pcr_framework/detection/ssd16_detection/')
composite.add(sd)
# Once the modules are incorporated, you can call process() to run them over
# the frames.
composite.process(ann, pred)
Visualize results
Visualize images, annotations, predictions, and processing results using the Viewer class.
from pcr_framework.src.viewer import Viewer
# Viewer class is used to visualize the results of the processing.
viewer = Viewer('pcr_framework_test')
for img_pred in pred.images:
viewer.set_image(img_pred)
composite.show(viewer, ann, pred)
Metrics evaluation
Compute evaluation metrics to quantitatively assess the performance of computer vision models.
ofs = open('pcr_framework/output/results.txt', 'w', encoding='utf-8')
composite.evaluate(ofs, ann, pred)
ofs.close()
python pcr_framework/output/eval_detection.py
Contributions
The PCR-UPM group welcomes your expertise and enthusiasm!
Small improvements or fixes are always appreciated. If you are considering larger contributions to the source code, please contact bobetocalo@gmail.com first.
Metadata
Release files for pcr-framework 2026.11.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pcr_framework-2026.11.6.tar.gz | 631.1 kB | Without provenance | Details for pcr_framework-2026.11.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pcr_framework-2026.11.6-py3-none-any.whl | Python 3 | none | any | Details for pcr_framework-2026.11.6-py3-none-any.whl |
Total release size: 696.3 kB
Release files / pcr_framework-2026.11.6.tar.gz
| Download URL | pcr_framework-2026.11.6.tar.gz |
|---|---|
| Size | 631.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
721dbfbf86bacb41fe440f209e712844eb9c410ff001c1870667954ed557c4f0
|
|
BLAKE2b-256 checksum How to use checksums |
a9ec99e60874b91549fff9895e8fc4c2143bc7ad0220ec048c84ca2e8974fae5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Release files / pcr_framework-2026.11.6-py3-none-any.whl
| Download URL | pcr_framework-2026.11.6-py3-none-any.whl |
|---|---|
| Size | 65.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
511874dd96854d98b28853f0d008919c948061453ece2b5a57410b8a485645ad
|
|
BLAKE2b-256 checksum How to use checksums |
92531b6299fce2f2333b114cf428f07e566aa57163634c20b3766896d87605c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.12
|
Security for pcr-framework 2026.11.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.