CNN training of experimental images for "Detection and tracking of barchan dunes using Artificial Intelligence"
Description
This is part of the dataset concerning the YOLO training of experimental images (Barchan dunes). In this dataset, you find the "YOLOv8 train" folder that contains the structure and images observed during lab experiments to train a CNN with images of barchan dunes, the "Train Results" folder that contains the figures and weights of YOLO detection of barchan dunes, the "Detection results" that contains some barchan dune detection and movies, and the "Code Files" that contains the scripts to detect barchan dunes, plot the morphology, train a YOLOv8, convert masks to polygons and plot resulting YOLO parameters. Some images are from Assis, W.R. and Franklin, E.M., Geophysical Research Letters, 47, e2020GL089464, 2020.
Files
Steps to reproduce
To detect barchan dunes in the laboratory 1. Download the files and keep the structure and folder names. 2. In your desktop create an "Experimental_data" and "output" folders. 3. Install the YOLOv8 network using the Ubuntu terminal and run the following command pip install -r requirements.txt. 4. Put the images to be detected in the "Experimental_data" folder. Note: All shapes must point upwards to calculate the morphology parameters. 5. Use the script "barchan_dunes_detection_lab.py" to detect barchan dunes. 6. In this script change the network weights source path "model_path" available in the Results train/weights folder, the input data path "image_path", and the output data path "output_images_path". 7. Modify the output image size (original image size) (line 55). 8. Modify the confidence to detect barchan dunes (line 59). 9. Run Python script. 10. Enter the conversion from pixel to millimeters. 11. Set the time interval between each image. 12. The detection results are in the "output" folder. 13. Review the text file "dataset.txt" with the morphology parameters. 14. Run the script "dataframe.py" to obtain the morphology figures of the Barchan dune. To execute this code, the file "dataset.txt" and the folder "figures" must exist. To train the YOLOv8 network 1. Download the files and keep the structure and folder names. 2. Install the YOLOv8 network using the Ubuntu terminal and run the following command pip install -r requirements.txt. 3. Create a dataset with a large number of images to be labeled. 4. Label the images using the segmentation method (masks). In the present work, the CVAT online program was used with two classes (Barchan and Not a barchan). Then we download the dataset labeled with the export format segmentation mask 1.1. 5. On your desktop create a "masks" folder with the dataset labeled and "labels" to obtain the polygons mask. 6. Open the script "mask_to_polygons_two_classes.py" and change the paths where your masks are located and where you are going to save the labels. 7. Modify the colors of your masks in the script (lines:24,25,62,63) and run it. 8. In the data/images folder you have to copy your original images and separate 90% dataset to train and 10% to validate. 9. Repeat the same previous step with the labels obtained in step 6 and copy them to the data/labels folder. 10. Configure the "config.yaml" file and change the data, images, and labels paths. 11. Open the script "train.py" and modify the parameters according to your needs, check if the pre-trained weight "yolov8n.pt" (segmentation) is in your work area, and run the script. 12. Finally, you have trained the YOLO network and it's going to save the new weights in the runs folder.
Institutions
Categories
Funding
Fundação de Amparo à Pesquisa do Estado de São Paulo
2021/11470-4
Fundação de Amparo à Pesquisa do Estado de São Paulo
2018/14981-7