A deeplearning package for the basegun weapon recognition app
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file basegun_ml-2.0.5.tar.gz.
File metadata
- Download URL: basegun_ml-2.0.5.tar.gz
- Upload date:
- Size: 39.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
592c530a59d3c22e2b03ac41290877aad856233c5eac1fb83b429333f6ad84b5
|
|
| MD5 |
3e4fa481f0600c60a92a9a05386498d9
|
|
| BLAKE2b-256 |
2ae0ca048a5e174b3cf4fcf25965780e9b60b3ea5abf87b210c797321a2df4d1
|
File details
Details for the file basegun_ml-2.0.5-py3-none-any.whl.
File metadata
- Download URL: basegun_ml-2.0.5-py3-none-any.whl
- Upload date:
- Size: 39.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9d17cb199f2649ab07ca2e901659ac154c790fc5e3fdf1399ecf57b223936e1
|
|
| MD5 |
d3d9d9720c728a42d47021401cd1a327
|
|
| BLAKE2b-256 |
7997c47f39dce87af1a88af110a752283ed8f446b87d13f54e7b85d3da531b19
|