Está en la página 1de 14

International Journal of Food

Volume 3, Issue 1 2007 Article 6

Pork Quality Classification Using a

Hyperspectral Imaging System and Neural
Qiao Jun∗ Michael Ngadi† Ning Wang‡
Aynur Gunenc∗∗ Mariana Monroy††
Claude Gariepy‡‡ Shiv Prasher§

China Agricultural University, Beijing, China, 100083, qiao

McGill University, Canada,

McGill University, Canada,
McGill University, Canada,
McGill University, Canada,
Agriculture and Agri-Food Canada,
McGill University, Canada,

Copyright 2007
c The Berkeley Electronic Press. All rights reserved.
Pork Quality Classification Using a
Hyperspectral Imaging System and Neural
Qiao Jun, Michael Ngadi, Ning Wang, Aynur Gunenc, Mariana Monroy, Claude
Gariepy, and Shiv Prasher


Pork quality is usually determined subjectively as PSE, PFN, RFN, RSE and DFD based on
color, texture and exudation of the meat. In this study, a hyperspectral-imaging-based technique
was developed to achieve rapid, accurate and objective assessment of pork quality. The principal
component analysis (PCA) and stepwise operation methods were used to select feature waveband
from the entire spectral wavelengths (430 to 980 nm). Then the feature waveband images were
extracted at the selected feature wavebands from raw hyperspectral images, and the average re-
flectance (R) was calculated within the whole loin-eye area. Artificial neural network was used
to classify these groups. Results showed that PCA analysis had a better performance than that of
stepwise operation for feature waveband images selection. The 1st derivative data gave a better
result than that of mean reflectance spectra data. The best classified result was 87.5% correction.
The error frequency showed that RSE samples were easier to classify. The PFN and PSE samples
were difficult to separate from each other.

KEYWORDS: pork quality, hyperspectral imaging, principal component analysis, stepwise re-
gression, neural network

Acknowledgement: The financial support of the Canadian National Science and Engineering
Research Council is gratefully acknowledged.
Jun et al.: Pork Quality Classification


Canada is one of the largest pork exporters in the world. With market expansion
and segmentation, the Canadian processing industry needs efficient technologies
for assessment of pork quality in order to maintain its leading position. Quality of
fresh pork varies greatly. Traditionally, pork quality used to be classified into
three categories based on color, texture (firmness) and exudation (drip loss). RFN
(Reddish pink, Firm and Non-exudative) pork has desirable color, normal texture
and water-holding capacity (WHC). PSE (Pale pinkish gray, very Soft and
Exudative) pork has undesirable appearance and lack firmness due to excessive
drip loss. DFD (Dark purplish red, very Firm and Dry) meats have firm and sticky
surface with high WHC, very little or no drip loss, and very high pH (NPB, 1999).
Over the years two other categories namely RSE and PFN have arisen. RSE
(Reddish, soft and exudative) pork has normal color, but a soft texture and an
exudative character similar to PSE (Kaufman et al., 1992). PFN is pale, firm and
non-exudative (Nam et al., 2002). PFN and RSE have been recognized recently as
major quality defects in Canada, which account for >13% in all defects compared
to PSE (13%) and DFD (10%) (Murray, 2000). According to the author, exudative
pork can induce an economic loss of $5 per carcass. An efficient and effective
quality assessment system is urgently needed for the meat industry to identify the
defects quickly and objectively.
Hyperspectral imaging techniques can provide not only spatial information,
as regular imaging systems, but also spectral information for each pixel within an
image. This information will form a three-dimension “hypercube” which can be
analyzed to ascertain minor and/or subtle physical and chemical features of an
object. Thus, a hyperspectral image can be used to detect physical and geometric
characteristics such as color, size, shape, and texture. It can also be used to extract
some intrinsic chemical and molecular information (such as water, fat, protein,
and other hydrogen-bonded constituent) from a product. Recently, several
hyperspectral imaging research were reported on quality assessment for meat,
fruit and vegetables. Kim et al. (2001) introduced a hyperspectral reflectance and
fluorescence imaging system for food quality and safety. Cheng et al. (2004)
developed a method to inspect damage of cucumber by hyperspectral image. A
similar approach was successfully developed to inspect the contamination of
chicken carcasses (Kim et al., 2004; Yang et al., 2005).
In this study, the potential of hyperspectral imaging techniques will be
exploited for pork quality level assessment. The specific objectives are:
To select feature bands to present the properties of different pork quality
levels based on spectral information acquired from the hyperspectral-imaging
system using principle components analysis (PCA) and stepwise operation; to

Published by The Berkeley Electronic Press, 2007 1

International Journal of Food Engineering, Vol. 3 [2007], Iss. 1, Art. 6

develop models for classifying the quality levels by Artificial Neural Network


2.1 Sample preparation

Fresh pork loins around the 11th rib were obtained from a local cutting house
(Olymel S.E.C./L.P., Quebec, Canada) from August to November of 2005. All the
samples were selected from different quality categories by the company
inspectors before shipped to the Instrumentation Laboratory at McGill University,
Quebec, Canada.
The loin samples were cut into chops in the laboratory with a thickness of
1cm. In total, eighty samples were used, including RFN (20), PFN (20), PSE (20),
and RSE (20). The overall experiment was conducted under a room temperature
between 20 and 22ºC.

2.2 Spectral image collection and feature waveband images selection

2.2.1 Hyperspectral imaging system

Figure 1. The hyperspectral imaging system

The hyperspectral imaging system consisted of a line-scan spectrograph

(ImSpector, V10E, Spectra Imaging Ltd, Finland), a CMOS camera (BCi4-USB-
M40LP, Vector International, Belgium), a DC illuminator (Fiber-Lite PL900-A, 2
DOI: 10.2202/1556-3758.1089
Jun et al.: Pork Quality Classification

Dolan-Jenner Industries Inc, USA), a conveyer (Dorner 2200 series, Donner Mfg.
Corp., USA), an enclosure, a data acquisition and preprocessing software
(SpectraCube, Auto Vision Inc., USA), and a PC as shown in Figure 1. The
ImSpector collected spectral images in a wavelength range of 400-1000 nm with a
spectral resolution of 2.8 nm and a spot radius < 9 µm. Two fiber-optic light-
guiding branches from the DC illuminator were mounted on the enclosure as a
light source. The conveyer was driven by a stepping motor with a user-defined
speed (MDIP22314, Intelligent motion system Inc., USA). The enclosure
(450×600×750 mm) was constructed with anodized aluminum columns enclosing
all sensitive components and providing a rigid platform.

2.2.2. Image acquisition and pre-processing

During image acquisition, pork samples were transported by the conveyer one by
one to the field of view (FOV) of the ImSpector with an optimized velocity of
1.58 mm/s. The convey speed was selected by trial-and-error to avoid distortion
on image size and spatial resolution and fit the predetermined camera expose
time. The FOV is a line area with 6 cm in length and 180 µm in width. The image
acquisition process was controlled by the SpectraCube software. When a sample
came into the FOV, a hyperspectral image was taken and the image was sent to
the PC through a USB port for storage. The images were stored in a raw format
before processed. One hyperspectral image was taken for each sample.
To correct the images from the dark current of camera, and to obtain relative
reflectance, a dark image and a white image were obtained by covering the lens
with a cap and taking a image from a standard white reference.
All the spectral images were preprocessed through the following four
procedures using the ENVI software (V. 4.1, Research System, Inc., USA) and
MATLAB 7.0 (The MathWorks, Inc., USA):
1. Calculating a relative reflectance using Equation (1):
I −B
I= 0 (1)
W −B
where I was the relative-reflectance of an image; I0 was the original image;
B was the dark image, and W was the white image,
2. Locating the center of a lion-eye image and defining a circular region of
interest (ROI) as 10,000 pixels around the center,
3. Calculating the mean reflectance spectrum (430 – 980 nm) for each image
by averaging the spectral responses of each pixel in the ROI. In total, 80
mean reflectance spectra were obtained, and
4. Smoothing each spectrum with a 20 points mean filter and calculating its
first derivative to correct multiplicative scatter and baseline and avoid the
overlapping peaks (Xing et al., 2003; Geesink et al., 2003).

Published by The Berkeley Electronic Press, 2007 3

International Journal of Food Engineering, Vol. 3 [2007], Iss. 1, Art. 6

2.2.3 Selection of feature band images

Two methods, principle components analysis (PCA) and stepwise regression were
used to selected feature bands from the mean reflectance spectrum and its first
derivative data obtained in section 2.2.2.
PCA have considerable utility in reducing numerous variables down to a
few principles. Mathematically, PCA produce several linear combinations of
observed variables, each linear combination a principle component (PC)
(Tabachnick and Fidell, 2001). PCA was conducted for the mean spectra
reflectance, and the feature bands were selected based on the greater weight of the
first three PCs. The wavelengths at which the greater weights were found were
selected as feature wavebands.
The stepwise regression was used to develop a subset of data that is useful to
predict the target variable, and to eliminate those data that do not provide
additional prediction in the regression equation (Tabachnick and Fidell, 2001).
The stepwise operation (SAS 8.0, SAS Institute Inc., Cary, NC) was done based
on the mean spectra reflectance with corresponding classified quality levels of
pork samples by qualified human inspector. The useful bands for predicting the
quality levels were determined as feature wavebands.
The feature waveband image sets were then extracted from original spectral
images at the feature wavebands.

2.3 Calculation of the average intensity of the feature band images

The average intensity of whole loin-eye area in each feature band images were
used to classify the quality levels.
The following masking method was developed to locate the loin-eye area in
a feature band image. The feature band image at 685 nm was used to make a mask
due to its significant contrast between the loin-eye area and the background. The
intensity histogram valley method (Amoroso, et al., 1999) was used to segment
the lean meat against fat and background. With multiple processes of erosion and
filling-holes, the loin-eye area and the other small lean area around the loin were
extracted (Figure 2). A particle filter (6000 pixels) was used to remove the small
lean meat area and the loin-eye area was masked. The masking operation was
done using a commercial software (WinROOF v3.12, MITANI Corporation,
Japan). 4
DOI: 10.2202/1556-3758.1089
Jun et al.: Pork Quality Classification

(a) (b) (c) (d) (e)

Figure 2. Masking operations. (a) band image at 685 nm; (b) image mask after
binarization using histogram valley method; (c) image mask after three times
erosions; (d) image mask after filling holes and erosion again; (e) image mask
obtained after particle removing.

For each feature band image, the average intensity (R) of the masked loin-
eye area was calculated. R was used as intensity features to develop classification
models for the quality groups of pork meat.

2.4 Feed-foreword neural network

A feed-forward neural network (FFN) models were established with the average
intensity R of feature band images as the inputs and the quality levels as the
outputs. The output includes two nodes to identify the quality levels as: RFN (1, -
1); PFN (-1,1); PSE (-1, -1) and RSE (1,1). One hidden layer with 10 neurons was
structured. The FFN was designed, trained, and tested using the MATLAB Neural
Networks Toolbox (The MathWorks Inc., Mass. USA). The transfer function of
Tansig was used for the hidden layer and Pureline for output layer, also learning
function of Learngdm and performance function Mse were used. The training
algorithm of Bayesian regularization (Trainbr) was used in order to avoid over
fitting. The leave-one-out cross-validation method (Mevik and Cederkvist, 2004)
was used for neural network training and tests. In each training process, only one
sample was selected as a test set. The other 79 samples were used as a training set.
In total, the training was performed 80 times and the classified output values of
the 80 samples were obtained.


3.1 Acquired hyperspectral images and spectral features

Acquired hyperspectral images in different quality levels are shown in Figure 3.

The colored images were obtained by combining images at wavelength of 720 nm
(red), 580 nm (green), and 460 nm (blue). Hence, an appearance closer to the
natural pork color was obtained with the combined wavelengths. The images in
near infrared range showed a better resolution, so these images may be used to

Published by The Berkeley Electronic Press, 2007 5

International Journal of Food Engineering, Vol. 3 [2007], Iss. 1, Art. 6

observe chemical attributes of samples. RFN and RSE were darker than PFN and
PSE. RSE sample also showed more marbling than others. Marbling and lean
contrasted more at wavelengths between 580 to 720 nm, especially at 661 nm.
Thus, these images may also be used to estimate marbling score.





Combined 460 nm 580 nm 661 nm 720 nm 850 nm 950nm

Figure 3. Acquired hyperspectral images, the colored images were obtained by
combined images at wavelengths of 460 nm, 580 nm and 720 nm

Figure 4 shows the mean spectra reflectance curves of the four quality
levels. PFN and PSE showed a higher reflectance than that of RFN and RSE due
the strong reflection of pale color. Water absorbing bands were clearly observed
at 750 and 950 nm. The first derivative corrected the multiplicative scatter. It
avoided the overlapping peaks and also corrected the baseline. The significant
differences in the range from 460 to 600 nm are attributed to differences in color
components. Whereas, the differences over 950 nm were mainly due to water
contents or other chemical features. The differences in spectral data suggested a
possibility of classifying the quality levels of pork samples using the spectral
features. 6
DOI: 10.2202/1556-3758.1089
Jun et al.: Pork Quality Classification

Figure 4. Mean spectra reflectance and its first derivative of different quality
levels pork samples

3.2 Selected feature waveband images

Weights of the first three PCs of the mean reflectance spectrum and its first
derivative were obtained after PCA analysis (Figure 5). The explained ratio by the
first three PCs was 99.13% for mean reflectance spectra and 81.29% for the first
derivative. The wavebands with greater weights were selected and are shown in
Table 1. There was no significant peak or valley of the weights of PC1 for the
mean reflectance spectra, hence the feature wavebands were selected from PC2
and PC3, and the first waveband was 980 nm. From the weights of the first
derivative data, the first waveband selected was at 657 nm. The selected
wavebands by stepwise regression are also shown in Table 1. The feature
waveband images were extracted at the feature wavebands from original spectral
images and their R was calculated from the masked whole loin-eye area.

Published by The Berkeley Electronic Press, 2007 7

International Journal of Food Engineering, Vol. 3 [2007], Iss. 1, Art. 6

Figure 5. Weights of the first three principle components at different wavelength,

upper, weights of average reflectance spectrum; lower, weights of the first
derivative of the average reflectance spectrum

Table 1. Selected feature wavebands by PCA and stepwise operation

Methods Selected feature wavebands (nm) Numbers
Ref.PC 980, 567, 833, 881, 481, 701, 918, 859, 530 9
Ref.SW2 615, 627, 934, 961 4
Deri.PC3 657, 622, 690, 783, 927, 961, 833, 496, 583, 851, 11
Deri.SW4 430, 458, 527, 560, 571, 600, 690, 707, 737, 851, 13
872, 896, 975
PCA for the mean reflectance spectrum;
Stepwise for the mean reflectance spectrum;
PCA for the first derivative of the mean reflectance spectrum;
Stepwise for the first derivative of the mean reflectance spectrum.

3.3 Classified pork quality levels

Classified results showed correction from 67.5 to 87.5 %. The best classified
result was 87.5 % correction, from the waveband images set of the Deri.PC.
Generally, the waveband images sets selected by PCA analysis had a better
performance than that by stepwise operation. The first derivative data could yield
a better result than that of the mean reflectance spectra data. Error frequency
showed the lowest value for quality level of RSE and the highest value for PFN. It 8
DOI: 10.2202/1556-3758.1089
Jun et al.: Pork Quality Classification

seem quality level of PFN was difficult to classify. Checking the misclassified
PFN samples (Table 3), the samples of 27, 37 and 40 were classified as RFN by
all of the waveband images sets. Based on the color of these three samples they
should be border samples between PFN and RFN. These three samples might
belong to RFN, since subjective classification is difficult to handle these border
samples. Observing the PFN and PSE groups, the higher frequency of
misclassification was from PFN to PSE, also PSE to PFN, respectively. Although
PFN and PSE showed a similar color, the internal attribute of texture and
exudation is different, these attributes are difficult to classify subjectively.

Table 2. Comparison of the performance of the different waveband images sets

for pork quality levels classification by FFN
Quality levels Ref.PC Ref.SW Deri.PC Deri.SW Error frequency
RFN 20(6)* 20(6) 20(2) 20(4) 18/80
PFN 20(8) 20(9) 20(5) 20(5) 27/80
PSE 20(5) 20(7) 20(1) 20(4) 17/80
RSE 20(2) 20(4) 20(2) 20(4) 12/80
Total 80(21) 80(26) 80(10) 80(17) 74/320
Correct (%) 73.75 67.50 87.50 78.75
*20(6), six error of classification within twenty samples


The study demonstrated potentials of a hyperspectral imaging system to classify
pork quality levels using neural network.
The feature waveband images were selected by PCA analysis and stepwise
operation from mean reflectance spectra data and its first derivative data.
Classified result showed that PCA analysis had a better performance than that of
stepwise operation for feature waveband images selection. And the first derivative
data could give a better result than that of mean reflectance spectral data.
Feature waveband images set selected by PCA analysis from the first
derivative data yield the best-classified result of 87.5% correction.
The error frequency showed the RSE samples were easier to classify. The
PFN and PSE samples were difficult to separate well between each other.

Published by The Berkeley Electronic Press, 2007 9

International Journal of Food Engineering, Vol. 3 [2007], Iss. 1, Art. 6 10
DOI: 10.2202/1556-3758.1089
Jun et al.: Pork Quality Classification

Amoroso, C., Ardizzone, E., Morreale, V., Storniolo, P. (1999). A New
Technique for Color Image Segmentation. The Proceedings of the 10th
International Conference on Image Analysis and Processing (ICIAP'99),
September 27 – 29, 1999, Venice, Italy. Pp. 352.

Cheng, X., Chen, Y.R., Tao, Y., Wang, C.Y., Kim, M.S., Lefcourt, A.M. (2004).
A novel integrated PCA and FLD method on hyperspectral image feature
extraction for cucumber chilling damage inspection. Transactions of ASAE.
47(4): 1313-1320.

Geesink, G.H., Schreutelkamp, F.H., Frankhuizen, R., Vedder, H.W., Faber,

N.M., Kranen, R.W., Gerritzen, M.A. (2003). Prediction of pork quality attributes
from near infrared reflectance spectra. Meat Science. 65: 661-668.

Kauffman, R.G., Cassens, R.G., Scherer, A., Meeker, D.L. (1992). Variations in
pork quality. National Pork Producer Council, Des Moines. IA

Kim, I., Kim, M.S., Chen, Y.R., Kong, S.G. (2004). Detection of skin tumors on
chicken carcasses using hyperspectral fluorescence imaging. Transactions of
ASAE. 47(5): 1785-1792.

Kim, M.S., Chen, Y.R., Mehl, P.M. (2001). Hyperspectral reflectance and
fluorescence imaging system food quality and safety. Transactions of ASAE.
44(3): 721-729.

Mevik, B., Cederkvist, H.R. (2004). Mean square error of prediction (MSEP)
estimates for principle component regression (PCR) and partial least squares
regression (PLSR). Journal of Chemometrics. 18(9): 422-429.

Murray, A.C. (2000). Reducing losses from farm gate to packer: A Canadian’s
perspective. Proceeding of 1st international virtual conference on pork quality.
Pp.72-84, Concordia, Brazil.

Nam, K.C., Du, M., Jo, C., Ahn, D.U. (2002). Effect of ionizing radiation on
quality characteristics of vacuum-packaged normal, pale-soft-exudative, and dark-
firm-dry pork. Innovative Food Science & Emerging Technologies. 3:73-79.

NPB (National pork board) 1999. Pork quality standards. Des Moines, IA USA.

Published by The Berkeley Electronic Press, 2007 11

International Journal of Food Engineering, Vol. 3 [2007], Iss. 1, Art. 6

Tabachnick, B.G., Fidell, L.S. (2001). Using multivariate statistics. A Pearson

Education Company. Needham Heights, MA 02494. ISBN:0-321-05677-9.

Xing, J., Landahl, S., Lammertyn, J., Vrindts, E., Baerdemaeker, J.D. (2003).
Effects of bruise type on discrimination of bruised and non-bruised ‘Golden
Delicious’ apples by VIS/NIR spectroscopy. Postharvest Biology and
Technology. 30: 249-258.

Yang, C.C., Chao, K., Chen, Y.R. (2005). Development of multispectral image
processing algorithms for identification of wholesome, septicemic, and
inflammatory process chickens. Journal of Food Engineering. 69:225-234. 12
DOI: 10.2202/1556-3758.1089