Skip to main content

Capsule Inference

This tool is used during development to quickly and easily run inference with a capsule.

Usage

Make sure you are running in an environment with vcap and vcap-utils installed.

Running is simple. Point the script to the capsule of choice, and list one or more images to run inference on. For example:

python3 capsule_infer.py --capsule my-detector-capsule/ --images img.png 
img2.png 

You can also point --images to a path that contains images.

Or download capsule-zoo to run capsule inference test on person, vehicle, bike,

python3 capsule_infer.py --capsule {capsule-zoo directory}/capsules/detector_person_vehicle_bike_openvino  --images {capsule-zoo directory}/tests/test_resources/two_people.jpg

Capsule Classifier accuracy

This tool is used during development to quickly and easily run accuracy benchmark with a capsule. The output is a set of benchmark reports.

Usage

Make sure you are running in an environment with vcap and vcap-utils installed.

Running is simple. Point the script to the capsule of choice, and list one or more images to run inference on. For example:

python3 capsule_classifier_accuracy.py --capsule <capsule directory or .cap> --images-true <true image directory> --images-false <false image directory> --data attribute=<name> true_threshold=0.0 false_threshold=0.0 detection=<class name>

Optional image categories are as follows,

--images, --images-true, --images-false

How to build openvisioncapsule-tools

Build in Docker, so the result does not depend on what is installed on your machine. Run this from the repository root. It builds the wheel and sdist with Poetry, installs the wheel into a clean environment, runs tools/tests against it, and only then exports the files to tools/dist/:

# 0.6.x line (Python 3.9, what the BrainFrame core runs)
docker build --file tools/Dockerfile.build --output type=local,dest=tools/dist .

# 0.5.x line (Python 3.8)
docker build --file tools/Dockerfile.build --output type=local,dest=tools/dist \
    --build-arg PYTHON_VERSION=3.8 --build-arg PYPROJECT=pyproject.toml.py38 .

If a test fails, the build fails and nothing is exported. Publishing is described in PUBLISHING.md.

Test openvisioncapsule-tools module installation

Build an Ubuntu image for testing the module installation with the following command, replace 20.04 with 22.04 or 24.04 as needed,

DOCKER_BUILDKIT=1 docker build --file tools/Dockerfile.ubuntu --build-arg UBUNTU_VERSION=20.04 --tag ubuntu-2004 --no-cache .

Run the Ubuntu image to test the module installation

docker run -it --rm -v ./tools:/open_vision_capsules/tools -w /open_vision_capsules/ ubuntu-2004 bash

Test the module installation in the docker container,

pip install tools/dist/openvisioncapsule_tools-0.5-py3-none-any.whl

Run the module

openvisioncapsule-tools

Running the tests

The tests drive the installed openvisioncapsule-tools command, so install the built package first (Python 3.9; see PUBLISHING.md for the build steps), then run

cd tools
python -m pytest tests -v

Metadata

Release files for openvisioncapsule-tools 0.6.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openvisioncapsule-tools 0.6.5
File Size Uploaded Provenance Actions
openvisioncapsule_tools-0.6.5.tar.gz 25.7 kB Without provenance Details for openvisioncapsule_tools-0.6.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openvisioncapsule-tools 0.6.5
File Interpreter ABI Platform Actions
openvisioncapsule_tools-0.6.5-py3-none-any.whl Python 3 none any Details for openvisioncapsule_tools-0.6.5-py3-none-any.whl

Total release size: 62.8 kB

Release files / openvisioncapsule_tools-0.6.5.tar.gz

Download URL openvisioncapsule_tools-0.6.5.tar.gz
Size 25.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3a283023a5d3d44951bd489d45a50e38ea1118f00d7a07915108b3be14e5e961
BLAKE2b-256 checksum
How to use checksums
6120abcce19217990eb6bf8315812bf0c6cfe05d823b2d885b39987681003d9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / openvisioncapsule_tools-0.6.5-py3-none-any.whl

Download URL openvisioncapsule_tools-0.6.5-py3-none-any.whl
Size 37.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe38876b22cc095be75480cd524ada2e3ffa3d392e75861e0241822883dcb46c
BLAKE2b-256 checksum
How to use checksums
85a3b6cb6a91343bf5e8ba7a68e86ba30159db3c87ba565b4e89ad408cd1d0c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for openvisioncapsule-tools 0.6.5

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page