Home - dnum-mi/basegun-ml GitHub Wiki

Welcome to the Basegun-ml wiki!
Basegun-ml repo contains all research code based on Machine Learning (ML) used in Basegun app, a tool for helping at the identification and legal categorization of firearms in France.

Classification

General explanations

What is an image classification algorithm ?

The type of algorithm used in Basegun aims at assigning a category, called label or class, to any image it sees. This category can only be one in a pre-defined list, it cannot think of any class outside this scope.

In Basegun's case, it categorizes an image in a list of families representing (generally) firearm mechanismes. This classification is based on descriptive, objective criteria which are independant from legal classification. For more info on this point check the Dataset section.

ℹī¸ Due to the way it works, the algorithm will try to find the fittest firearm for any image. Even a cat image will be categorized as a kind of firearm ! This is a technical choice we made to have better performance for distinguishing firearms.

This type of algorithm is called Supervised classification for Computer Vision (= for images/videos).

Confidence score

The output of a classification model applied to a image is a array size number of classes which contains for each class the probability that this image is of this class = the confidence score. For instance if we have 5 classes, the output [0.1, 0.2, 0.5, 0.05, 0.15] means that the algorithm thinks:

  • there is 10% chance this image is of class 1
  • there is 20% chance this image is of class 2
  • etc. Consequently, in this example we consider the image of probably of class 3, since it's the class with highest confidence score.

In Basegun app, in order to deliver an information easily understandable by the user, we only return the name and confidence score of the class with the highest score.

Dataset

The dataset is the collection of images used to train the algorithm. Indeed, since we use a supervised type of algorithm, we need to "teach" our algorithm how to recognize the images. For that purpose, we feed it a large (tens of thousands) number of pairs (image, label) where the label is the real class of the image. After this training we hope that for new images where we don't know the class, the algorithm will be able to guess it on its own. More details about the dataset for classification

Our works

Measure of firearm's length

Previous work available here

Why Measure Firearm Length?

Measuring the overall length of a firearm or its barrel length is crucial for its legal classification. In fact, in France, the classification of long guns is dependent on these lengths.

For example, a long gun with a shorter barrel is easier to conceal and thus poses greater risks. Consequently, it will be assigned a higher legal class compared to a similar firearm with a longer barrel.

The selected method to address the use case of measuring firearm length is keypoint detection.

Our works

Automatic Detection of Alarm Guns

What is an Alarm Gun?

An alarm gun is a type of blank gun recognized as an alarm by French legislation. This type of blank gun is considered impossible to modify to make it lethal. Therefore, it has its own legal classification: C12.

How to Recognize an Alarm Gun?

Currently, there are two ways to recognize an alarm gun:

  • If the gun has the PTB marking. PTB marking
  • If the gun is one of the 20 models defined as an alarm gun by French legislation.

The objective is to determine if a gun is an alarm gun using only an image of the gun.

Our works