The Forest Guard project represents a pioneering approach to combatting illegal deforestation in Romania by harnessing the power of AI and computer vision technologies. It introduces a novel and innovative solution that empowers citizens and law enforcement agencies to monitor and track wood transportation activities effectively.
The application employs advanced algorithms to detect license plate numbers using bounding box detection and OCR text recognition. It also extracts legal documents from the SUMAL 2.0 platform, ensuring compliance with forestry regulations and facilitating real-time monitoring of wood transports.
Additionally, the app includes a state-of-the-art wood log detection feature, which utilizes a custom YOLOv8n model to detect and calculate wood volume accurately. By transforming pixels into centimeters and applying mathematical formulas, the app provides precise measurements, enabling users to verify the legality of wood transports.
Deforestation in Romania is an alarming and rapidly escalating issue, posing a significant threat to the nation's environment, economy, and overall well-being. The statistics are striking: an estimated average loss of 3 hectares of forests every hour, resulting in a substantial annual economic setback of approximately $6 billion, equivalent to a significant 2% of the country's GDP. What's even more concerning is that only 1% of illegal deforestation wood transport is currently caught.
A) License Plate DetectionDevelop a bounding box detection model using YOLOv8 to identify license plates in images, incorporating a pixel-to-cm ratio to find a 52 cm reference length. Integrate an OCR API to recognize and extract text from the detected license plates, enabling the extraction of legal documents. |
B) Extracting DocumentsExtract from the national legal platform SUMAL to access real-time legal documents related to timber transports and forestry regulations. |
C) Wood Log DetectionImplement a wood log detection model using YOLOv8 to identify and localize logs in images. Calculate wood log volume using mathematical techniques and compare it with real volume data to detect discrepancies and potential illegal logging activities. |
License Plate Dataset | Wood Log Dataset |
---|---|
Total Images: 1,457 Training: 1,075 Validation: 382 Sources: Processing:
|
Total Images: 2,585 Training: 1,846 Validation: 739 Sources: Processing:
|
A) Models
- YOLOv8 Nano (6.3 MB): Selected for its balance of small size and fast inference speed,
making it suitable for mobile deployment. |
B) Experiments
-Several experiments were conducted with YOLOv8X and YOLO-NAS, but YOLOv8 Nano yielded the
best results in terms of accuracy and efficiency. |
C) Hyperparameters
|
SUMAL 2.0 regulates and monitors the transportation of wood on public roads in Romania. It mandates a legal notice containing:
import requests from bs4 import BeautifulSoup license_plates = ['SB40DAP'] #-> License Plate Number base_url = 'https://inspectorulpadurii.ro/api/aviz' for plate in license_plates: response = requests.get(f'{base_url}/locations?nr={plate}').json() codes = response['codAviz'] if not codes: print("Legal Notice not found") for code in codes: resp_2 = requests.get(f'{base_url}/{code}').json() # Getting volume volume = resp_2['volum']['total'] # Getting valdity valid_from = get_date(resp_2['valabilitate']['emitere']) valid_to = get_date(resp_2['valabilitate']['finalizare']) print({'Code': code, 'Volume': volume, 'Validity': f'{valid_from} - {valid_to}'})
A) ModelsWe opted for YOLOv8n due to its renowned performance in object detection tasks. Through training over 30 epochs, our model attained impressive accuracy, ensuring reliable detection of wood logs across various environmental conditions. |
B) ExperimentsSeveral experiments were conducted with YOLOv8S, DETR, and YOLO-NAS. YOLOv8 Nano yielded the best results in terms of accuracy and efficiency during testing and validation phases. |
C) Hyperparameters
|
Pixel to Centimeter Ratio | Diameter |
---|---|
Bounding Box Pixels : 52 (Standard EU License Plate Length) |
The diameter is extracted by taking the length of the bounding box of each log and converting it into centimeters using the pixel-to-centimeter ratio. |
Our application utilizes edge detection techniques to perform real-time processing directly on the user's device, without relying on cloud platforms or external APIs. This ensures smooth and fast performance even on mobile devices, providing users with a seamless experience.
One of the key features of our app is its ability to detect multiple bounding boxes for license plates in real-time. This enables users to quickly identify and select the correct license plate number from the predictions. If the predicted number is incorrect, users can easily modify it manually by long-pressing on one of the options, ensuring accurate data capture.
In addition to license plate detection, our app also includes real-time detection of wood bounding boxes. Users can center the trucks within the frame, and the app will continuously detect and refine the bounding boxes until the user is satisfied with the results. This ensures accurate tracking and monitoring of wood transportation activities.
To further enhance accuracy, our app waits for user confirmation before finalizing any predictions or calculations. This allows users to review and validate the detected information, ensuring that only accurate data is added to the verified trucks section. By empowering users to confirm the accuracy of the predictions, our app provides a reliable and trustworthy solution for wood transportation monitoring.
To test the app, clone the repository and navigate to the forest_guard
directory. Run the following command:
git clone https://github.com/patrick25076/forest_guard.git cd forest_guard flutter run
Ensure you are connected to an emulator or a real device. Contact me for the APK file if needed.