Research Notes Supporting Development of a Drone Mapping and Object Counting Workflow

I am using this page for tracking my research notes during development of an open source drone mapping and object counting workflow. Newest notes are at the top.

The workflow document is a work in progress and largely incomplete, but available here.

March 15, 2024

STRATUS conference talk has been accepted! I’ll be in Syracuse NY USA May 19-22nd. Time to get this work finished!

February 15, 2024

Project is mostly on hold due to other priorities.

January 30, 2024

Abstract submitted to the 2024 STRATUS conference:
“Developing an Open-Source Object Counting Workflow for Aerial Imagery”

January 29, 2024

Python and YOLOv7 setup notes from local:

  • Install Python for Windows 3.12.1 (THIS VERSION DOES NOT WORK; SEE BELOW)
  • Confirm python and pip are available from command line
  • clone yolov7 repository – git clone https://github.com/WongKinYiu/yolov7.git
  • cd yolov7
  • pip install -r requirements.txt
    • errors
  • Remove python 3.12.1, install 3.11.7
  • pip install -r requirements.txt
  • success!

YOLOv7 References

YOLOv7 installation and use references:

  • https://inside-machinelearning.com/en/use-yolov7/

YOLOv7 training references:

  • https://blog.roboflow.com/yolov7-custom-dataset-training-tutorial/

YOLOv7 general references:

  • https://towardsdatascience.com/yolov7-a-deep-dive-into-the-current-state-of-the-art-for-object-detection-ce3ffedeeaeb

Training Data on Roboflow Universe:

  • https://universe.roboflow.com/search?q=aerial
  • https://universe.roboflow.com/riis/aerial-sheep

Other Notes

January 16, 2024

Returning to workflow development this week, following a break for holidays and some time dedicated to other projects. Work continues, but on a new laptop. Reinstalled WebODM and QGIS, and the next task is to get the YOLOv7 model development installed and configured.

Planning to submit an abstract related to this workflow development, for the 2024 STRATUS conference.

QGIS and Deepness Plugin

I installed a clean QGIS (I am using 3.28 LTS “Firenze”) and immediately tried to install and activate the Deepness plugin.

However, this error appeared. I believe it is because I did not install the necessary prerequisites for Deepness.

Closing the error I received a note about required dependencies:

Selecting “install packages” raises a couple of blank consoles, then should eventually indicate that “packages installed correctly”.

This is the Deepness plugin, as shown in the plugin manager:

Spent some time searching for QuickMapServices so I could add an OSM basemap under my orthophoto, then realized that QMS is a plugin and I had not installed it on the new laptop. This is the plugin:

If required dependencies are not available, the Deepness icon does not appear in the QGIS toolbar:

November 27, 2023

Status Summary: Overall workflow is set up and tested with a car-counting model. So this is the “drone photos to object counts” path:

  • Drone photos
  • -> WebODM orthophoto
  • -> QGIS raster layer
  • -> Objects detected and counted
  • -> Locations marked in a separate vector layer

If you want to count cars, you can re-use an existing model from the model zoo (quick and easy). If you have an existing object detection model and some QGIS knowledge, this is very easy to set up and run.

Greatest effort for most applications will be training an object detection model for your topic of choice. The second greatest effort will be assessing and demonstrating the accuracy of the computer counts.

November 26

Ran a quick orthophoto of snowy automobiles in an impound lot. Total of 250-275 vehicles visible in the orthophoto. Deepness found approximately 28 (10%).

Tweakable detection parameters in Deepness plugin:

  • Confidence threshold (default = .50)
  • IoU (Intersection over Union) threshold (default = .50)
  • Remove overlapping detections (default = enabled)

Lowering confidence threshold to .4, .3, .2 produced successively more detections (.4 = 35, .3 = 40, .2 = 70) Most new detections were appropriate but a few were partial vehicles.

November 7

Working to understand the overall process of developing a custom YOLOv7 model via the jupyter notebook “car_detection__prepare_and_train.ipynb”

  • Install YOLOv7
  • Prepare dataset
  • Prepare YOLO configuration
  • Run training
  • Run testing
  • Export model to ONNX
  • Add metadata for QGIS Deepness plugin
  • Test model using QGIS

YOLO Overview references

  • https://blog.paperspace.com/yolov7/
  • https://learnopencv.com/yolov7-object-detection-paper-explanation-and-inference/

Training YOLOv7 model references

  • *https://learnopencv.com/fine-tuning-yolov7-on-custom-dataset/
  • https://blog.roboflow.com/yolov7-custom-dataset-training-tutorial/
  • https://blog.paperspace.com/train-yolov7-custom-data/

Training Dataset requires

  • Dataset directory with images and labels
  • Dataset YAML descriptor file, which goes in yolov7/data/MY_DATA.yaml

NEXT: continue with Section 3.1 of https://learnopencv.com/fine-tuning-yolov7-on-custom-dataset/

November 5

Deepness plugin setup: https://qgis-plugin-deepness.readthedocs.io/en/latest/main/main_installation.html

  • Requirements setup
    • Python3 – test from powershell “python3” should open python session – quit()
    • pip – test from powershell “python3 -m pip” should show help info
  • Plugin installation
    • Use QGIS plugin manager
    • Had to install dependencies again from plugin install dialog, but it worked that time
    • See screenshots
  • Model installation
    • Model zoo: https://qgis-plugin-deepness.readthedocs.io/en/latest/main/main_model_zoo.html
    • Find an ONNX model you want to use. (e.g., Aerial Cars Detection). Click link to download it.
  • Test
    • Open QGIS, new project
    • Add orthophoto as raster layer
    • Enable quick map services layer (OSM) for context
      • Must install QuickMapServices plugin for this
    • Launch Deepness plugin (control panel on right)

Deepness UI videos: https://qgis-plugin-deepness.readthedocs.io/en/latest/main/main_ui_video.html

Car detection example: https://qgis-plugin-deepness.readthedocs.io/en/latest/example/example_detection_cars_yolov7.html

Model training tutorial: The entire training process has been gathered in a tutorial notebook in jupyter notebook: ./tutorials/detection/cars_yolov7/car_detection__prepare_and_train.ipynb

Jupyter: https://jupyter.org/

Jupyter 101: https://www.dataquest.io/blog/jupyter-notebook-tutorial/

Working with Jupyter Notebooks in VSCode: https://python.land/data-science/jupyter-notebook#Jupyter_Notebook_in_VSCode

November 3-4, 2023

Initial planning and documentation setup. Preliminary target for toolset is WebODM, QGIS, Deepness plugin, and DotDotGoose for developing training data.

“Open Source Drone Mapping and Object Detection Workflow” needs a much shorter, punchier working title.