This script allows the user to easily count the number of fruits in the images provided at the input and then presents the results as a JSON file. Currently, the script can detect the following 3 types of fruits:
-
apples
-
bananas
-
oranges
Script detect_fruits.py
takes 2 input parameters:
data_path
- path to the folder with data (photos)output_file_path
- path to the file with the results
$ python3 detect_fruits.py --help
Options:
-p, --data_path TEXT Path to data directory
-o, --output_file_path TEXT Path to output file
--help Show this message and exit.
In the Linux console, the script can be called from the project directory as follows:
python3 detect_fruits.py -p ./data -o ./results.json
The detection results are outputted into a JSON file for all images in the catalog.
{
...,
"07.jpg": {
"apple": 2,
"banana": 1,
"orange": 1
},
...
}