crop-image-classification
is an automated Python/R code used to perform Machine Learning (ML) experiments and their automated analysis, including plots and tables. Thus, this repository includes all the necessary files to reproduce our paper Image Classification for Precision Agriculture: A Coffee Study Case
.
This repository is structured as follows:
- dataset-brazilian_coffee_scenes/: contains all the original images (with coffee and noncoffee regions) explored in this study;
- data/: contains all the datasets generated to execute the ML experiments;
- scripts/: contains the scripts we designed to perform experiments (preprocessing images, ML experiments, DL experiments, and so on);
- results/: contains all the generated results (in .csv files);
- analysis/: contains the automated analysis designed to refine results. It includes charts, tables, and statistical tests.
There are four main and important files:
- 01_generate_datasets.py: It generates the datasets we feed traditional ML algorithms;
- 02_generate_folds_for_DL.py: it splits data into training and testing folds to perform DL experiments, keeping the same data partitions evaluated in traditional ML algorithms;
- 03_traditional_ml_predictions.py: executes several traditional ML algorithms on datasets generated by the first script. Experiments are repeated 30 times with different seeds;
- 04_running_CNN.py: trains and tests a simple CNN on the same data partitions. Experiments are repeated 30 times with different seeds;
- 05_running_VGG.py: trains and tests a VGG16 network on the same data partitions. Experiments are repeated 30 times with different seeds;
The automated analysis is contained in the analysis subfolder. There, you need to run the R script ``mainAnalysis.R''. Of course, all the previous scripts must be executed before. Otherwise, there will not be the data needed to perform analysis.
All these scripts were designed to run separately, but there is a natural dependency between scripts according to their numbers: 01_,02_, 03_, 04_ and 05_. For example, the VGG script (05_) will only work if the second script has been executed; otherwise, it will fail.
To run Python scripts, please use the following commands:
pyhton3 01_generate_datasets.py &
# pyhton3 02_generate_folds_for_DL.py &
# pyhton3 03_traditional_ml_predictions.py &
# pyhton3 04_running_CNN.py &
# pyhton3 05_running_VGG.py &
Just use the commented commands for the other scripts. To run the automated analysis, please do the following:
cd analysis
Rscript mainAnalysis.R &
This paper was presented in COTB 2024. Check the proceedings page for more information.
- Julio Ribeiro ([email protected] ), Federal Technology University - Paraná (UTFPR) - Apucarana - PR, Brazil.
- Matheus Mileski ([email protected]), Federal Technology University - Paraná (UTFPR) - Apucarana - PR, Brazil.
- Rafael Gomes Mantovani ([email protected]), Federal Technology University - Paraná (UTFPR) - Apucarana - PR, Brazil.
- Luiz Fernando Carvalho ([email protected] ), Federal Technology University - Paraná (UTFPR) - Apucarana - PR, Brazil.