https://github.com/dnum-mi/basegun
Web app for identifying a firearm based on a picture
https://github.com/dnum-mi/basegun
classification-model firearms python pytorch vue
Last synced: 7 months ago
JSON representation
Web app for identifying a firearm based on a picture
- Host: GitHub
- URL: https://github.com/dnum-mi/basegun
- Owner: dnum-mi
- License: agpl-3.0
- Created: 2021-10-15T14:13:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-21T07:04:04.000Z (7 months ago)
- Last Synced: 2025-07-21T09:14:16.590Z (7 months ago)
- Topics: classification-model, firearms, python, pytorch, vue
- Language: Vue
- Homepage: https://basegun.interieur.gouv.fr/
- Size: 172 MB
- Stars: 16
- Watchers: 2
- Forks: 0
- Open Issues: 34
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Basegun
## Project context
According to the [French gun legislator](https://www.interieur.gouv.fr/ministere/organisation/secretariat-general/service-central-des-armes-et-explosifs), 20 000 firearms are seized each year in France, 15 to 20% of which are misidentified or unidentified.
This leads to errors in the legal classification of weapons and has the following consequences:
* A lack of criminal prosecution, or conversely, unjustified prosecution
* Over-solicitation of firearms experts
* Erroneous sales of weapons subject to authorization by civilian gunsmiths
**Project summary**
Develop an app for the law enforcement forces where they just need to take a photo of a firearm to obtain an identification result.
**History of the product:**
* 2021/09/13: the Direction of Numeric of French Ministy of the Interior hires [a developer and a data scientist](https://eig.etalab.gouv.fr/defis/basegun/) to develop a Minimum Viable Product for 10 months.
* 2022/03: first prototype in production (basegun.fr)
* 2022/09: tests with real users from police and gendarmerie
* 2024/02: solution deployed to all professional mobile phones of gendarmerie forces in France on https://basegun.interieur.gouv.fr
## Technical Stack
[](https://vuejs.org/)
[](https://fastapi.tiangolo.com/)
[](https://www.typescriptlang.org/)
[](https://www.python.org/)
[](https://vitejs.dev/)
[](https://pinia.vuejs.org/)
[](https://vue-chartjs.org/)
### Linter
[](https://github.com/astral-sh/ruff)
[](https://eslint.org/)
[](https://prettier.io/)
### DSFR (French State Design System)
[](https://vue-ds.fr/)
### Requirements
Dependancies :
[](https://pnpm.io/)
[](https://packaging.python.org/en/latest/tutorials/installing-packages/)
[](https://www.gnu.org/software/make/manual/make.html)
[](https://www.docker.com/)
[](https://docs.docker.com/compose/)
See also [Debugging](https://github.com/dnum-mi/Basegun/blob/develop/backend/README.md#debugging) section for all the env variables needed for the website to work fully operationally.
## Setup project for development
### Build containers
```bash
# install in dev mode
make build
```
### Launch containers
```bash
# run
make up
# stop
make down
```
### Setup frontend and launch using Vite
Use ``pnpm install`` on ``frontend`` folder
Use ``pnpm run start`` for start the website with Vite
### Lints and fixes files
Use ``pre-commit run --all-files`` for linting on frontend and backend folders
## Debugging
* If the interface of the website does not appear on ``http://localhost:5173``, there is an issue with frontend. In terminal, run `docker logs basegun-frontend`
* If the interface shows up properly but there is a bug at image upload, there is an issue with the backend. Try to find error log:
* In terminal, run `docker logs basegun-backend`
* If you cannot access terminal or don't see anything, go to `http://localhost:5000/logs` to see latest logs.
* Beside frontend and backend services, we use some containers in dev which simulate some services provided by our cloud provider: s3 storage, mail server... See our [infrastructure repo](https://github.com/dnum-mi/basegun-infra) for more info about app architecture.
## Testing the website like you were a police or gendarme user with Keycloak
1. Set your User Agent to 'SAID'
2. Go to ``http://localhost:5173/expert-contact``.
This will redirect you to a login page where you have two options :
* If you want to test the police path, use `police` as username and `password` as password.
* For the gendarmerie path, use `gendarmerie` as username and `password` as password.
(see [keyclock conf](https://github.com/dnum-mi/basegun/blob/develop/keycloak/realm-export.json))
## Release an official version of code
1. Update tag in Makefile
2. `make tag`
This will create a draft release in github (to validate) and some docker image packages with this tag.
> If you made a tagging error, run `make untag`. This will delete the tag locally and in the remote.
## Licence
Due to its usage of python library [Ultralytics](https://github.com/ultralytics/ultralytics/blob/main/LICENSE), BaseGun uses copyleft [GNU Affero General Public License v3.0 (AGPL-3.0)](https://www.data.gouv.fr/fr/pages/legal/licences/).