Spaces:
Running
Download README.md from FahimFBA/SafeLicensing: direct link, hf CLI and curl.
- Browser
- Download file 5.52 kB
-
https://huggingface.co/spaces/FahimFBA/SafeLicensing/resolve/main/README.md
- Command line
-
hf download hf://spaces/FahimFBA/SafeLicensing/README.md
-
curl -L -o README.md https://huggingface.co/spaces/FahimFBA/SafeLicensing/resolve/main/README.md
A newer version of the Streamlit SDK is available: 1.66.1
title: SafeLicensing
emoji: 🛡️
colorFrom: indigo
colorTo: blue
sdk: streamlit
sdk_version: 1.38.0
app_file: app.py
pinned: false
license: mit
SafeLicensing
This project demonstrates a pipeline for detecting license plates in images using YOLOv8 and encrypting the detected regions with a Chaotic Logistic Map encryption algorithm. It provides a user-friendly interface built with Streamlit.
You can directly test the application on the web using the following link:
Features
- License Plate Detection: Uses the YOLOv8 model to detect license plates in uploaded images.
- Chaotic Encryption: Encrypts the detected license plate regions using a two-layer XOR-based chaotic logistic map algorithm.
- Streamlit Web App: A simple interface to upload images, detect license plates, encrypt them, and download the results.
Installation
Clone the repository:
git clone https://github.com/FahimFBA/SafeLicensing.git cd SafeLicensingInstall
ffmpegfor video processing (Linux):sudo apt-get install ffmpegor, for macOS:
brew install ffmpegInstall the required dependencies:
pip install -r requirements.txtDownload the YOLOv8 weights file (
best.pt) and place it in the root directory of the project. You can train your own model or use a pre-trained one. This repository already have our model from SEncrypt located in best.pt file.
Usage
Run the Streamlit app:
streamlit run app.pyOpen the app in your browser (typically at
http://localhost:8501).Follow the steps:
- Upload an image or provide a URL.
- Adjust the encryption key seed using the slider.
- Click the "Detect & Encrypt" button to process the image.
Download the encrypted image directly from the app.
Docker Usage
You can run this application using Docker. There are two options: CPU-only and GPU-enabled.
CPU Version
Build the Docker image:
docker build -t safelicensing .Run the Docker container:
docker run -d -p 8501:8501 --name safelicensing_container safelicensing
GPU Version (for NVIDIA GPU users)
Ensure you have the NVIDIA Container Toolkit installed. If not, follow the official installation guide.
Build the GPU-enabled Docker image:
docker build -f Dockerfile.gpu -t safelicensing-gpu .Run the GPU-enabled Docker container:
docker run -d -p 8501:8501 --gpus all --name safelicensing_gpu_container safelicensing-gpu
Common Steps
Check if the container is running:
docker psYou should see a container named
safelicensing_containerorsafelicensing_gpu_containerin the list.View the container logs:
docker logs safelicensing_container # or safelicensing_gpu_container for GPU versionThis will show you the Streamlit startup logs and any errors if they occur.
Open the app in your browser by navigating to
http://localhost:8501.
If you encounter any issues:
- Ensure that port 8501 is not being used by another application.
- Check the container logs for any error messages.
- If needed, you can stop and remove the container using:
Then, try running the container again.docker stop safelicensing_container # or safelicensing_gpu_container docker rm safelicensing_container # or safelicensing_gpu_container
Note: The GPU version requires an NVIDIA GPU and proper drivers. If you don't have a compatible GPU, use the CPU version instead.
Workflow
License Plate Detection:
- The YOLOv8 model is used to detect license plates in the input image. The model has been taken from SEncrypt.
- Detected regions are highlighted with bounding boxes.
Chaotic Logistic Map Encryption:
- A chaotic logistic map generates two XOR-based encryption keys.
- Pixels in the license plate regions are shuffled and encrypted in two stages.
- The encrypted region replaces the original plate in the image.
Visualization and Download:
- The original, detected, and encrypted images are displayed in the app.
- Encrypted images can be downloaded as PNG files.
Files
app.py: The main Streamlit app file.requirements.txt: Python dependencies for the project.best.pt: YOLOv8 weights file (not included, add your own).
Key Parameters
- Encryption Key Seed: A slider in the app adjusts the seed value for the chaotic logistic map, affecting the encryption's randomness.
Example Screenshots
Original Image
Encrypted Image
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Contact
For any queries, feel free to reach out:
Author: Md. Fahim Bin Amin
GitHub: FahimFBA
Other Authors: Rafid Mehda, Israt Jahan Khan

