Researchers at the University of South Australia are using machine learning for hyperspectral imaging to detect toxic contamination that causes food poisoning.
One of the first applications of artificial intelligence was formed in 1951 – a program written for the games of checkers and chess. In recent years, AI has taken the world by storm with platforms applicable across industries, reducing labour and simplifying processes.
When it comes to the food and beverage industry, many associate AI with data analysis and automating processes in machinery. However, in a world where food safety and quality assurance are increasingly critical, the use of AI and machine learning has the potential to go far beyond to save lives.
New research led by the University of South Australia (UniSA) is paving the way for smarter and more efficient contamination detection. Through the combined efforts of an international team of researchers, the study aims to eliminate harmful toxins in food specially nuts before they reach consumers.
Published in the journal ‘Food Chemistry, Correlation awareness evolutionary sparse hybrid spectral band selection algorithm to detect aflatoxin B1 contaminated almonds using hyperspectral images’, it describes the integration of machine learning with advanced hyperspectral imaging (HSI) to identify toxins that can contaminate food.

The paper is authored by lead author and UniSA PhD candidate Ahasan Kabir, Associate Professor Ivan Lee and Professor Sang-Heon Lee (UniSA); Professor Chandra Singh (Lethbridge College, Canada); and assistant professors Gayatri Mishra and Brajesh Kumar Panda (Indian Institute of Technology Kharagpur).
Four million deaths from food poisoning
So, what exactly is being detected? From cultivation to storage of cereal grains and nuts, different types of fungi can grow, producing numerous mycotoxins. Mycotoxins are toxic, mutagenic, and carcinogenic compounds that cause a range of health issues when consumed by humans and animals.
According to the World Health Organisation (WHO), close to 600 million people fall ill due to food contamination, leading to 4.2 million deaths. With mycotoxin contamination posing a threat to public health as a common cause of food poisoning, economic and health losses each year build trade barriers.
In Kabir’s PhD study, he focused on the detection of aflatoxin B1 in almonds, a mycotoxin classified as a Group 1 carcinogen by the International Agency for Research on Cancer. According to him, aflatoxin B1 is the most dangerous of the four main aflatoxins (B1, B2, G1, and G2). These naturally occurring contaminants thrive in warm and humid environments and can cause liver damage and long-term health issues. It also poses a threat to both public health and trade.
Contamination can occur at almost any point along the supply chain, from growth and harvest to drying through to packaging and transportation. International regulations place strict limits on allowable toxin levels, meaning that even small breaches can lead to entire export shipments being rejected.
“Australia’s the second largest almond-growing country,” said Kabir. “When they export almonds to countries like Europe and Japan, they regulate how much aflatoxin is present in an almond.”
Kabir explained that the goal of the research is to develop technology that can identify highly contaminated almonds before export, protecting both consumers and producers.
Overhauling the traditional approach
Conventional aflatoxin detection relies on chemical testing using high-performance liquid chromatography (HPLC). This method provides high accuracy and selectivity with detection levels as low as 0.01 ppb. It involves grinding large batches of almonds into powder, mixing them with methanol solutions, and conducting chromatographic analysis in a laboratory.
While it proves to be effective, it has its downsides.
“The current process is destructive, time consuming, and runs into issues with random sampling,” said Professor Lee.
Typically, out of a 20-kilogram sample, only a 100-grams homogeneously ground portion is used for testing. This means that if the results show contamination levels higher than the standard, the entire lot will be rejected. The HPLC test is done in two different laboratories and from start to finish, one sample can take nearly an hour to prepare and analyse. Since only a small number of nuts are tested from each batch, there is always a risk that contaminated almonds remain undetected.

The UniSA research takes a new approach. Instead of relying on chemical destruction, it uses HSI combined with machine learning to detect toxins based on the light spectrum reflected from each almond. This method allows rapid and non-destructive testing of entire batches in real time.
Where AI comes in
Most people are familiar with standard red, green and blue (RGB) imaging used in everyday cameras. Hyperspectral imaging extends this principle by capturing data across hundreds of narrow light bands beyond the visible spectrum of 280 to 750 nanometres, including near-infrared wavelengths, which Kabir explained range from 900–1,700 nanometres.
In this study, a hyperspectral camera capable of scanning wavelengths invisible to the human eye produces 224 distinct channels. Each channel represents a specific light wavelength, providing detailed information about the chemical composition and structure of the material being scanned. By analysing these light patterns, the team can determine which spectral regions are most sensitive to the presence of aflatoxin B1.
The technology’s strength lies in its ability to pinpoint spectral features invisible to the human eye. While an almond contaminated with aflatoxin may look identical to a safe one under normal light, hyperspectral imaging reveals subtle chemical differences. These differences are then classified using trained artificial intelligence models, allowing for rapid screening of almonds on a conveyor belt without physical contact or chemical processing.
Then there is machine learning. Utilising its algorithms to process the data and identify contaminated almonds within milliseconds – a process called ‘dimensional reduction’ and ‘classification’ – machine learning can help distinguish toxic nuts from safe ones with an accuracy of more than 93 per cent. Without machine learning, the amount of data in a hyperspectral image is enormous and cannot be handled by a traditional statistical classifier. With the capabilities of algorithms built for learning complex data, HSIs can be performed accurately.
Beyond nuts
According to the United Nations specialised agency Food and Agriculture Organisation (FAO), around 25 per cent of the world’s crops are contaminated by mycotoxin-producing fungi. To combat this, a fast and reliable framework such as HSI with machine learning is required to handle threats like aflatoxin B1, which can detect and quantify the mycotoxin at a maximum acceptable level from complex food materials.
Although the study began with almonds, its potential extends beyond the nut industry. The same hyperspectral imaging principles can be applied to pistachios, grains, rice, and barley – all of which can be affected by similar toxins. Additionally, the technology extends beyond foods.
“This technology has been around for more than 10 years and applied not only in the food and beverage sector, but also in agriculture, medical, and satellite applications,” said Kabir.

In agriculture, it helps identify soil composition, crop health, and potential contamination. In medicine, the technology is used to detect conditions such as skin cancer and breast tumours by analysing tissue composition without invasive procedures. In satellite imaging and mining, it analyses soil chemistry and detects mineral deposits.
By boosting this technology through machine learning, it offers a scalable and non-invasive solution across multiple industries. One of the features of this approach is the ability to work in real time. With further development, HSI and machine learning could be deployed on processing lines or handheld devices, reducing health risks and trade losses by ensuring that only safe, uncontaminated produce reaches consumers.
What’s next?
While the technology is still primarily used in laboratory research, the next challenge lies in translating it to industrial environments. The UniSA team is now collaborating with industry partners to move from research prototypes to scalable, commercial systems. Supported by the federal government’s Research Training Program and funding from Australian Nut Producer, SureNut Australia, the team is refining the technique to improve accuracy and reliability through deep learning and AI.
SureNut Australia is currently trialling a prototype imaging system that uses a mounted camera over a conveyor line. The system aims to automatically detect and reject aflatoxin-contaminated almonds in real time, reducing waste and ensuring only safe products are packaged.
“Our future aim is to hopefully apply this technology in other areas that can detect other toxins,” said Professor Lee.
For food and beverage manufacturers, this represents an opportunity to integrate smarter detection systems that align with global expectations for traceability, sustainability, and consumer protection. The combination of hyperspectral imaging and machine learning may soon define a new standard for food safety – not one that begins in the lab, but on the production line itself.
