Вы находитесь на странице: 1из 5

Automatic Grain Quality Inspection with Learning Mechanism

Y.-N. Wan

National Chung Hsing University, Dept. of Agricultural Machinery Engineering, 250 Kuokwang Road, Tai-Chung, Taiwan,China

Fel: +886-4-22857585,

Fax: +886-4-22879351

Mail: ynwan@nchu.edu.tw

Abstract: Automatic grain quality inspection using machine vision provides not only quick but also objective, consistent and quantitative measurement. An efficient automatic grain quality inspection system using computer vision associated with grain quality inspection software was developed. Sixteen parameters relating to rice appearance characteristics were used to categorize rice kernels into 13 inspection categories. In this study, learning mechanism was built into the system to increase its smartness to help the parameterspreparing and sorting precision tuning. Three classifying methods namely range selection, neural network and hybrid algorithms were implemented in the inspection software. According to tests, the neural network method needed about 20 minutes compared to the range selection method needed about 6 hours to set the classification parameters. The hybrid method needed about 40 minutes to set the classification process and achieved the same inspection accuracy as that of the range selection method. Results indicated that 90.9% of the rice kernels sorted by the system were consistent with those sorted by a human inspector, and the average processing speed was over 1200 kernels/minute.

Keywords: grain quality; network; computer

1 Introduction

Rice is an important staple food in Asia, and high-quality rice with mature, plump, clear, and undamaged kernel appearance is always more valued by consumers. Rice quality inspection by humans relying upon the naked eye is neither objective nor efficient. Impartial inspection may sometimes err as a result of inexperience, or inspection may be deliberately shifted out of sympathy for the producers. We have developed an automatic grain kernel handling system that can consecutively present over 1296 singularized kernel images per minute for machine vision inspection (Wan, 2002). A continuation of the research, investigates aspects associated with the performance of the automatic quality inspection system for evaluating various rice appearance characteristics. A Windows-based software program for rice quality inspection was developed to facilitate machine operation, preparation of grading parameters, and classification accuracy tuning (Wan, et. al, 2002). However, rice quality has multi-dimensional attributes and many of them are subjective, thus to perform complex adjustment of the sorting parameters for a variety of rice became a complicated task. In this study, a learning mechanism was built into the system to increase its smartness to help the parameterspreparing and sorting precision tuning. Three classifying methods namely range selection, neural network and hybrid algorithms were implemented in the inspection software. The performances of inspector machine operation, preparation of grading parameters and classification accuracy tuning using this system with different sorting algorithms were studied. The rice quality inspection and sorting performance of the smart system as compared with results of human inspection was measured.

2 The automatic inspection system

The system was composed of two main parts, an inspection machine and an image-processing unit as shown in Figure 1. In brief, the rice kernel handling procedure involved the following steps. First, rice kernels were scattered over a predetermined matrix positioned on a conveyer belt of the machine feeding section, and moved to be photographed by the two CCD (charge-coupled device) cameras connected to the

445

computer of the image-processing unit. The computer segregated the kernel images from the background, provided a recognition process, and transferring the final sorting results to the machine controller. In the discharging section, the controller signaled each corresponding pneumatic valve to eject the kernels from the carrying holes into collection containers. An interface protocol was developed between the inspection machine and the image-processing unit to coordinate their concurrent activity. As shown in Figure 1, a Sony XC-711 color CCD camera was used on the first (right) photographic section to examine kernels illuminated from above. A Sony XC-75 black and white CCD camera was used on the second (left) photographic section to inspect cracked kernels illuminated from below. They sent NTSC (National Television Standards Committee) signals to a Coreco Oculus-Tci image frame grabber that had a resolution of 640(H) x 480(V). A PentiumII-350 MHz personal computer was used for image processing, quality recognition, and machine operation. Histogram and threshold methods were used to separate each kernel from its background. A photographed image, containing up to 24 matrix-positioned kernels, was processed to obtain each kernel image for parameter calculation (Wan, 2002). The boundary of each rice kernel was traced and described by an eight-direction chain code. Fundamental grain image-processing and parameter calculation functions were developed in C and compiled into a dynamic link library (DLL). The grain quality inspection windows, as shown in Figure 2, for sorting parameter preparation and machine operation were developed in Visual Basic to facilitate the design of a graphical and user-friendly interface. The windows display three images of kernels lit overhead, lit underneath and categorized images, together with a table showing information of total kernels processed, the system performance, and the number of categorized kernels in each category.

2 1. Feeding section 3 2. CCD cameras 3. Light sources 4. Discharging section 5.
2
1. Feeding section
3
2. CCD cameras
3. Light sources
4. Discharging section
5. Conveyer belt
6. Shielding plate
7. Machine controller
Hopper
Image processing unit
4
6
3
Grain images
1
5
Inspection machine
Valves
7 RS-232
3 Grain images 1 5 Inspection machine Valves 7 RS-232 Figure 1-Automatic grain quality inspection system

Figure 1-Automatic grain quality inspection system

Figure-2 Grain quality inspection windows

3 Rice inspection categories

In this study, there were 13 brown rice inspection categories, sound kernels, green mature kernels, chalky kernels (white, green), cracked kernels, broken kernel, immature kernels (green, white), dead kernels (white, green), damaged kernels (including rusty, discolored, abnormal, and insect-damaged kernels), off-type kernels and paddy, which are based on appearance as a result of differences in variety, growing environment, blight, harvesting maturity, storage conditions, and post-harvest processing. Only sound kernels, as shown in Figure 3, have the required quality. A high percentage of sound kernels in a batch of rice usually indicates better rice quality. According to the official inspection criteria (CNS, 1995), the top grade of rice must contain over 75% sound kernels, not over 4% dead kernels, not over 3% chalky kernels, and not over 3.7% total of damaged, broken, off-type kernels, and paddy (rough rice). There were 16 appearance characteristics used to categorize brown rice. These parameters can be classified into three groups: (1) Shape and contour characteristics: kernel area, perimeter, compactness (perimeter 2 / area), and length / width ratio (L/W); (2) Color and reflection characteristics of a kernel surface: average gray-levels of red, green, and blue color; standard deviations of green and blue color distribution on the surface, green-red (G/R) and blue-red (B/R) ratios, and chalky area divided by the overall kernel area (chalky ratio); and (3) Characteristics of image illuminated from below: maximum gray-level difference (MGLD) between adjacent blocks on

446

Normalized

a kernel, kernel area of image illuminated from below (B-area), area ratio of kernel illuminated from

below to overhead (A-ratio), and average gray-level of kernel illuminated from below (transparency). Images of cracked kernels illuminated from below had a high gray-level difference on the two sides of

a fissured line. A slim rectangular searching frame seeking out crack along kernel long axis, and the MGLD between adjacent frames was calculated as an inspection parameter for detecting cracks.

4 Classification algorithms and Tests

The first sorting algorithm was a range-selection method implemented as a series of tables (Wan et. al, 2002). Each table was related to one quality category with all characteristic parameters listed as a logical "and" assembly. The implemented parameters appeared as a text list with lower and upper values, and either one or both could be enabled or disabled in the window. A rice kernel was categorized when its image parameters fell within the ranges of a table. The tables were arranged in an examination sequence from worst to best; the sorting sequence from worst to best was dead, damaged, off-type, broken, chalky, cracked, immature, and sound kernels. The examination was on a "worst fit first" basis, which means that a kernel would be categorized into the worst quality category first. The neural network was a three-layer error back-propagation (EBP) model using normalized input parameters, sigmoid activation function, and learning method with initial learning constant 0.5 and fixed moment constant 0.4. The learning cycle was 50,000 iterations. The advantage of using neural network method was that it did not required time-consuming tests and modifications to increase the inspection accuracy. However, several rice categories had many similar characteristics, such as white immature, chalky, and dead kernels; green immature, chalky, and dead kernels; damaged and off-type kernels; sound and cracked kernels. The similar groups showed little difference in inspection parameters, making them difficult to be distinguished by the neural network method. Therefore, the hybrid method was used to increase the classification accuracy by combining appearance-alike categories together. The appearance-alike kernels were classified in the second step using reduced range selection method with only one or two parameters. The experimental brown rice could be categorized into thirteen inspection categories. The calibration kernel samples, 100 kernels for each category, were sorted by human inspectors from a randomly selected sample of kernels. To test the validity of the inspection parameters and the categorization performance between machine and human inspection, validation rice kernels were randomly sampled from the rice batch, put into the machine for online inspection, and sorted into collection containers. The machine had six collection containers, which were assigned as dead (green and white), immature (green and white), chalky (white and green), cracked, sound (green mature), and others. The "others" container collected paddy, broken, off-type, and damaged kernels. The kernels in each container were re-examined by an experienced inspector to study the consistency between the machine and the inspector.

study the consistency between the machine and the inspector. Figure 3- Rice inspection categories 1.0 0.9

Figure 3- Rice inspection categories

1.0

0.9

0.8

0.7

0.6

0.5

0.4

0.3

0.2

0.1

0.0

Dead-g Dead-w Damaged Off-type Broken Chalky-w Chalky-g Cracked Immature-w Immature-g Sound Sound-g Paddy g:
Dead-g
Dead-w
Damaged
Off-type
Broken
Chalky-w
Chalky-g
Cracked
Immature-w
Immature-g
Sound
Sound-g
Paddy
g: Green
w: White
A
P
C
L/W
R
G
B
Gs
Bs
B/R
G/R
Ch
Ua
Ar
T
M

Parameters

A: area, P: perimeter, C: compactness, L/W, R: red, G: green, B: blue, Gs: green s.d., Bs: blue s.d., B/R: blue/red, G/R: green/red, Ch: chalky, Ua: U-area, Ar: A-ratio, T: transparency, M: MGLD

Figure 4- Normalized parameter values

447

5 Results and Discussion

Figure 4 shows the distributions of the 16 inspection parameters for the thirteen rice inspection categories measured from the calibration rice samples. The denominator of the normalization for each inspection parameter was the maximum value of the parameter measured from the rice samples. In the neural network training process using 16 parameters to recognize the 13 rice categories, half of the kernels of the rice samples were applied as calibration; the recognition accuracy was about 75.9%. Combining appearance-alike rice categories such as white dead, immature and chalky kernels; green dead, immature, and chalky kernels; damaged and off-type kernels; cracked and sound kernels, could increase the recognition accuracy to 92.7%. The hybrid method continued the process using the range selection method to separate the appearance-alike rice kernels. The average inspection accuracy of the hybrid method was 86.4%.

Table 1 Consistency between machine and human inspection (N. N.)

Category

Collection containers

 

Total

Category

 

1

2

3

4

5

6

kernel

accuracy

Dea

Immatur

Chalk

Cracke

Soun

Others [a

s

(%)

d

e

y

d

d

]

Dead

468

145

31

7

13

49

714

65.6

Immature

78

457

41

7

5

1

590

77.4

Chalky

39

23

1035

37

44

11

1189

87.0

Cracked

11

31

77

2019

186

11

2335

86.5

Sound

12

5

38

183

3027

6

3271

92.5

Others

21

3

9

31

7

75

147

51.2

Total

629

663

1232

2285

3282

154

8246

kernels Purity [b] (%) 74.3

68.9

84.0

88.4

92.2

48.8

Overall accuracy (%)

 

85.9

Table 2 Consistency between machine and human inspection (hybrid)

Category

Collection containers

 

Total

Category

 

1

2

3

4

5

6

kernel

accuracy

Dea

Immatur

Chalk

Cracke

Soun

Others [a

s

(%)

d

e

y

d

d

]

Dead

460

17

34

7

10

45

574

80.1

Immature

60

541

15

10

10

8

645

83.8

Chalky

14

29

1003

25

11

13

1096

91.6

Cracked

9

1

14

1881

193

17

2115

88.9

Sound

5

8

25

51

3328

16

3433

96.9

Others

9

15

14

31

27

199

294

67.6

Total

558

611

1106

2005

3580

298

8157

kernels Purity [b] (%) 82.6

88.6

90.7

93.8

93.0

66.8

Overall accuracy (%)

 

90.9

[a] Others: paddy, off-type, damaged, and broken kernels.

[b] Number of kernels

determined by human inspector / number of kernels in the associated container. [c] Overall accuracy = (476 + 456 + 1003 + 1747 + 3532 + 273) / 8265. Table 1 and 2 shows online machine inspection results compared with those of human inspection using over 8000 randomly sampled rice kernels and using the neural network, and the hybrid sorting algorithms. The inspection accuracies were 85.9% for the neural network method and 90.9% for the hybrid method compared to the accuracy 90.6% for the range selection method. Most of the ambiguous kernels among sound, chalky and cracked containers showed small variance in projection area, chalky ratio or fissure line clarity that affected their being sorted into one category or another. Using the hybrid method, we found the chalky, cracked, and sound containers to be 90.7%,

448

93.8% and 93.0%, respectively. The category accuracy of chalky, cracked and sound kernels using the hybrid method were 91.6%, 88.9% and 96.9%, respectively. The sorting variance for 10 tests using 20,000 random sampled rice kernels and the hybrid method ranged between 0.03% and 0.16%. The variance in each rice category was small. The average processing speed for brown rice quality inspection in this system was over 1200 kernels/minute compared to human inspection of about 60 kernels/minutes. Using the range selection method, experienced inspector took about 6 hours to complete the parameter adjustment process. The range selection method was less flexible and required much more work to tune up the inspection parameters. The neural network method proved most convenient. After the rice sample images were stored in the control computer, following the processes of neural network training and then parameter setting in the inspection software, most inspectors could complete the classification preparing process in 20 minutes and achieved the similar inspection accuracy as shown in Table 1. Compared with the neural network, the hybrid method required an additional 20 minutes to set the classification module. The hybrid method employs less (in the test only one parameter) parameters to separate the appearance-alike rice kernels. In terms of accuracy, stability and convenience of preparing sorting parameters for various grains, the hybrid method performed better on quality classification with the automatic vision inspection system.

References

1 Wan, Y.-N. 2002. Kernel handling performance of an automatic grain quality inspection system. Trans.

ASAE 45(2):369-378.

2 Wan, Y.-N., C.-M. Lin, and J.-F. Chiou. 2002. Rice quality classification using an automatic grain quality inspection system. Trans. ASAE 45(2):379-388.

449