Project description
Basegun_ml is a deeplearning package for the basegun weapon recongition app.
Installation
pip install basegun-ml
Usage
Classification
Gun Mechanism Classification: This feature categorizes an image into a list of families representing different firearm mechanisms. The classification is based on descriptive, objective criteria that are independent of legal classification.
from basegun_ml.classification import get_typology, list_typologies
#After the import the model is already warmed-up for faster inference
#Convert image to bytes
with open("test.jpg", "rb") as file:
image_bytes = file.read()
#Prediction of the weapon typology
typology,confidence_score,confidence_level=get_typology(image_bytes)
#Obtain the list of the different typologies
list_typologies()
Variables description
Measure length
Measure Length Module: Measuring the overall length of a firearm or its barrel length is crucial for its legal classification. In France, the classification of long guns depends on these measurements. This module measures these lengths using an image.
from basegun_ml.measure import get_lengths
#Convert image to bytes
with open("test.jpg", "rb") as file:
image_bytes = file.read()
#Get lengths
weapon_length,barrel_length,confidence_card=get_lengths(image_bytes)
Variables description
Alarm Model detection
Alarm Gun Recognition: An alarm gun is a type of blank gun recognized as an alarm by French legislation. These guns are considered impossible to modify to make them lethal. The associated algorithm detects alarm guns using markings on the weapon.
from basegun_ml.ocr import is_alarm_weapon
#After the import the model is already warmed-up for faster inference
#Convert image to bytes
with open("test.jpg", "rb") as file:
image_bytes = file.read()
#Prediction of the weapon typology
alarm_model = is_alarm_weapon(image_bytes, quality_check=True )
Variables description
Tests
Tests are available for the classification task and the measure length task
pytest tests/test_classification.py
pytest tests/test_measure.py
pytest tests/test_OCR.py
Credits
- This project uses the Ultralytics Library
- The oriented bounding box detection is inspired from this YOLOV5 implementation
- The image quality analysis uses Pyiqa
- The OCR tasks are computed using PaddleOCR
Metadata
Release files for basegun-ml 2.0.7
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 | |
|---|---|---|---|---|
| basegun_ml-2.0.7.tar.gz | 39.5 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| basegun_ml-2.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 78.9 MB
Release files / basegun_ml-2.0.7.tar.gz
| Download URL | basegun_ml-2.0.7.tar.gz |
|---|---|
| Size | 39.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2991b22c9579a21f8ccf707a306813babc7d37e7bb2eaa44a9a57f77d53b05de
|
|
BLAKE2b-256 checksum How to use checksums |
5b23fff101d60127045f737eb9f577ff2ae33c92514749fc1c511d26199a74d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / basegun_ml-2.0.7-py3-none-any.whl
| Download URL | basegun_ml-2.0.7-py3-none-any.whl |
|---|---|
| Size | 39.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5b35a154b3416acb1e0b96a97b043231031b7497d5009b582bef98d5b0af9704
|
|
BLAKE2b-256 checksum How to use checksums |
3085a6a5c90b290e7485bfa162d6a3ceaaee23be4200a0a2c8154acc349ca038
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Security for basegun-ml 2.0.7
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.