Automated kernel shrivel detection of walnuts in shell

Nothing beats x-rays to find out what’s hidden inside opaque and dense objects. So, once we heard about the kernel shrivel problem we set out to try x-rays at once. Here’s a simplified report of our preliminary work, which we decided to put out there to look for potential interest in the industry.

X-ray imaging of walnuts in shell

We imaged 166 walnut samples, kindly provided by Quality Walnut Producers Pty Ltd. The imaging work has been done in the x-ray lab of Dr Marcus Kitchen at Monash University. We used a medical (mammography) x-ray unit and a flat panel digital detector. The x-ray unit was set to 35 kVp and 50 mAs. Walnut samples were placed in close proximity of the flat panel detector to acquire images. All walnut samples were placed in approximately the same orientation with respect to the detector.

Some result

Here’s the image overview of some of the samples we measured. We made sure to have a wide range of size and shell colour. Moreover we used walnuts from different growing regions around Victoria and New South Wales.


As a starting point of our analysis, we classified the walnuts by visual inspection of the x-ray images as having 1) normal kernel, 2) kernel with mild shrivel and 3) kernel with significant shrivel. An example of the three types is below. Left: normal kernel. Middle: mild shrivel. Right: Substantial shrivel.


Automated kernel shrivel detection

We developed an automated sorting algorithm which, starting from the x-ray images, returns the classification in terms of normal kernels, moderate shrivel or severe shrivel. After that, we quantified the performance of the automated algorithm, by evaluating accuracy metrics.

The overall accuracy of the algorithm was about 87%, and all the sever shrivel cases where correctly identified. The result overview is in the heatmap below.


From these value one can compute the sensitivity and specificity of the algorithm. Results are:

  • Sensitivity (percentage of the kernels with severe shrivel that are rejected by the sorting algorithm): 100%
  • Specificity (percentage of normal kernels that are accepted by the sorting algorithm): 88.7%

The results of this preliminary analysis show that our automated sorting algorithm is able to detect and reject shrivelled kernels with very good accuracy. There is definitely room for improvement, ideally bringing both specificity and sensitivity around 95%.

For more detail about the classification algorithm and data processing, feel free to get in touch.

Need help with your project?