Author: Shu-Min Tan, Shih-Hsun Hung, and Je-Chiang Tsai, National Tsing Hua University.
Last update: Mar 10, 2024
To clone the source code from GitHub, type
$ git clone https://github.com/Arc13Tangent/GCBICT.gitin the command line, then navigate to the GCBICT folder and type
$ cd GCBICT
$ pip install -r Requirements.txtto install all the required packages specified in the Requirements.txt.
The command-line tool GCBICT consists of two functions: (1) the Qualified-Defective Separator and (2) the Mixed Separator.
The Qualified-Defective Separator allows users to choose the images of multiple qualified and defective green coffee beans in the training stage, then train the machine learning model to obtain model parameters, and finally apply the trained model to the image of unevaluated beans to identify their quality. The Mixed Separator allows users to choose the images of a group of qualified beans with multiple growing sites/varieties, then train the machine learning model to obtain model parameters, and finally apply the trained model to the images of a group of qualified beans with multiple growing sites/varieties to identify their growing sites/varieties. Users can view the model details and identification results in the Model and Result folders. The algorithms that use our color characteristics of the seat coat of green coffee beans in GCBICT are patented.
Our recently discovered intrinsic color characteristics of the seat coat of green coffee beans. Panels (A), (B), (C) present the statistical features of the chosen 30 qualified beans, while (D), (E), (F) give the statistical features of the chosen 30 defective beans.
To run GCBICT, open the terminal, navigate to the GCBICT folder, and input the command python main.py:
$ cd GCBICT
$ python main.py # or python3 main.pyUsers type Q to select the Qualified-Defective Separator.
Then, respectively, type Q and D to input the folders' paths where the images of the qualified and defective beans of the training set are stored.
After the above steps,
type T to obtain the model of support vector machine (SVM) type. The model file is placed in the Model folder.
The computed color characteristics of beans' image and the confusion matrix of the machine learning model are shown in the following graphs.
After the training stage, users type E to leave the training mode, and then type I to select the identification mode.
In the identification mode,
input the path of the folder where the images of unevaluated beans are stored.
Then the GCBICT uses the model obtained in the training stage to identify the qualified and defective beans of the test set.
The user first types E to leave the Qualified-Defective Separator and then types M to select the Mixed Separator.
Next, type T to select the training mode.
Then type C to specify the number of growing sites, and input the path of the folder where the images of beans of each growing site in the training set are stored.
Next, type T to obtain the model of support vector machine (SVM) type.
The model file is placed in the “Model” folder
and the confusion matrix of the machine learning model is shown in the following graph.
After the training stage, users type E to leave the training mode
and then type I to select the identification mode. In the identification mode, input the path of the folder where the images of unevaluated beans are stored. Then the GCBICT uses the model obtained in the training stage to identify the growing sites of beans in the test set. The result is placed in the “Result” folder.
The identification result for beans from different growing sites. The bean with the green (red and blue) box is identified as being from site 1 (site 2 and site 3, respectively).










