close-circle
Close
0%
0%

AI based Adulteration Detector

To determine the type and amount of adulteration in a given substance using Image Processing.

Similar projects worth following
close
Adulteration is one of largest prevailing problem in the world. Adulteration means addition of another substance to a food item in order to increase the quantity of the food item in raw form or prepared form, which may result in the loss of actual quality of food item that can even be dangerous to health. These substances may be other available food items or non-food items. Although several techniques are used to find the adulteration they are completely complex, inaccurate and testing varies from one substance to other. There are several adulterated food substances released into the market and people cannot identify it easily. People find it difficult while choosing the best food substance. They cannot rely on chemical or manual testing while buying products from a store/grocery. Hence a suitable device that can be used for finding out adulteration in almost all substances is essential.

ADULTERATION

The Federal Food, Drug, and Cosmetic (FD&C) Act 2888) states that food is "adulterated" if it meets any one of the following criteria:

  • It bears or contains any "poisonous or deleterious substance" which may render it injurious to health.
  • It bears or contains any added poisonous or added deleterious substance (other than a pesticide, food additive, color additive, or new animal drug, which are covered by separate provisions) that is unsafe.
  • Its container is composed, in whole or in part, of any poisonous or deleterious substance which may render the contents injurious to health.
  • It bears or contains a pesticide chemical residue that is unsafe.

Food also meets the definition of adulteration if:

  • It is, or it bears or contains, an unsafe food additive.
  • It is, or it bears or contains, an unsafe new animal drug.
  • It is, or it bears or contains, an unsafe color additive.
  • It consists, in whole or in part, of "any filthy, putrid, or decomposed substance" or is otherwise unfit for food.

Further, food is considered adulterated if:

  • It has been irradiated and the irradiation processing was not done in conformity with a regulation permitting irradiation of the food in question.
  • It contains a dietary ingredient that presents a significant or unreasonable risk of illness or injury under the conditions of use recommended in labeling (for example, foods or dietary supplements containing aristolochic acids, which have been linked to kidney failure, have been banned).
  • A valuable constituent has been omitted in whole or in part or replaced with another substance; damage or inferiority has been concealed in any manner; or a substance has been added to increase the product's bulk or weight, reduce its quality or strength, or make it appear of greater value than it is.
  • It is offered for import into the United States and is a food that has previously been refused admission, unless the person reoffering the food establishes that it is in compliance with U.S. law [21 U.S.C. § 342].

AVAILABLE METHODS FOR DETECTING ADULTERATION

Milk: Add a drop or two of iodine solution to a few drops of milk. If the solution turns blue then, it contains starch (which is used to give it a thick, rich texture).

Butter/ghee: Take small amount of ghee or butter in test-tube and heat it up. Take a small amount of sugar and dissolve it in 10 ml of hydrochloric acid (Hcl). Now, add the solution to the mixture of butter and ghee. If it turns red, then the ghee or butter is adulterated.

Mustard oil: Take small amount of mustard oil in a test-tube, add a few drops of nitric acid to it. Shake and heat the mixture for 2-3 minutes. Appearance of red colour indicates that argemone oil is added to mustard oil.

Turmeric powder, dals and pulses: Take a spoon of dal, turmeric or besan powder and let it dissolve in lukewarm water. Add a few drops of hydrochloric acid to it. If it turns pink, violet or purple, it shows that Metanil yellow is present in it.

Sugar: Take a spoon of sugar, dissolve it in water and allow it to settle. While sugar will dissolve in water, chalk will not and thus will remain as residue at the bottom.

Effects of Adulteration
 It is injurious to health.
 It causes many diseases.
 It also causes deficiency diseases as it...

PROPOSED SOLUTION

This "AI based adulteration detector" device consists of a micro-controller, a camera module and power supply. The OS must be programmed in a such a way that it must start image processing as soon as the device is powered up. The High Definition (HD) pictures of original and pure substances are obtained and their characteristics & properties are analysed and these data are stored in the SD card of Raspberry Pi. The pictures of test samples are then captured through an camera module attached to that of Raspberry Pi. Several...

Read more »

adulteration v1.f3d

3D modelling of the Cuboid Box

fusion - 96.36 kB - 07/24/2017 at 04:52

download-circle
Download

Adobe Portable Document Format - 236.39 kB - 04/30/2017 at 13:29

eye
Preview
download-circle
Download

  • 1 × Raspberry Pi 3 model B Microcontroller that processes the data and uses Artificial Intelligence to find out the amount of adulterated substance in the sample.
  • 1 × Camera Module V2.1 Captures images of the sample substance and sends it to RPI for processing using AI and transmit data over Wi-Fi for cloud storage
  • 1 × Google Cloud Data from RPI can be sent to Bluemix cloud for storing and retrieving the data for comparison and processing from cloud using the Wi-Fi capability
  • 1 × Tensorflow Machine Learning technique adopted for image classification and comparison
  • 1 × Raspberry Pi LCD Screen Interface To notify the user regarding the type and amount of adulterant added to the substance

  • Cuboid Design

    G.Vignesh07/23/2017 at 17:00 0 comments

    In the previous log I had mentioned about the hardware setup. Now let's place these in a compact box for taking perfect images by providing good lighting conditions.

    I have designed a box of dimensions 13x9x9 cm of inner thickness 2mm to accommodate all the components and is made up of non-reflective material. I have literally used a cardboard box but I would prefer a 3D printed box because of its ruggedness and spacing of the components without damage. To 3D print the box design the box according to the given specifications using a CAD software(I have used Fusion 360) and convert the file into a gcode file then print the material. The filament that can preferably used will be wood as it is a non-reflective and hard material to house the components.

    LED Strips

    The inner surface of the box is surrounded by LED strips upto 6cm from base. The light emitted by the LED strips must not affect the lens and hence the strips are placed 1cm above the lens of the module. 

    The strip is made of flexible PCB material, and comes with a weatherproof sheathing. You can cut this stuff pretty easily with wire cutters, there are cut-lines every 1.3"/3.4cm (1 LED each). Solder to the 0.1" copper pads and you're good to go. Of course, you can also connect strips together to make them longer, just watch how much current you need! We have a 5V/2A supply that should be able to drive 1 meter and a 5V/10A supply that can drive up to 10 meters (depending on use) You must use a 5V DC power supply to power these strips, do not use higher than 6V or you can destroy the entire strip.

    The lens of the camera module is placed inside the box in such a way that it is 4cm from the base. A small opaque plate of thickness 2mm is placed as a base such that it does not reflect the light back to the camera. 

  • Getting started with the hardware!

    G.Vignesh07/23/2017 at 13:57 0 comments

    Previously I had posted logs indicating the possibility of image processing for adulteration detection using software only. In the upcoming logs I will be posting updates regarding the project using the hardware and software as well. 

    The hardware setup is so simple that the camera module connected to a Raspberry Pi is placed inside a closed box and a LED strip is placed inside to give suitable lighting conditions such that a perfect image can be captured and could be subjected to image processing. 

    Raspberry Pi 3 Model B

    It is a super cool mini computer that costs only 50$ and I am using this because of its infinite possibilities. It stand out from other development boards as it supports WiFi, BLE, slots for USB, HDMI interface, camera and display ports!  Install the required files and software, power up and you are ready to play!

    Image result for raspberry pi camera v2

    Raspberry Pi camera Version 2.1

    The camera module that I have used for the project is a V2-1080p, 8 megapixel camera. I have used a normal camera and not the NoIR camera module. The NoIR effectively captures images using the IR and is mainly used for picturing images during night. On the other the normal camera can take perfect images during day or normal vision. That becomes more suitable for this project as I will be using artificial lighting.

    Image result for raspberry pi camera v2

    This module comes with an infinite focus which means, objects at farther distance are more clearer than the near objects. The lens of the camera module has to be adjusted to preferred focal length by turning the lens either clockwise/anticlockwise. Since I require an focal length of less than 7cm I need to reduce the focal length by rotating the lens in anti-clockwise direction. I used a pair of pliers to adjust the focal length. One set was used to hold the base of the module tightly and the other was used to rotate the lens. During the process there were some scratches while using pliers but luckily the plastic region was damaged little bit and the lens was unharmed!!!

    This is a risky process as one has to be careful with the pliers or they may end up in damaging the module and you may require to buy another module.

    For time being I utilized the pliers and I would suggest to use this 3D printed custom made pliers for this process posted in thingiverse for safe usage. 

    https://www.thingiverse.com/thing:1574661

    Image result for raspberry pi camera v2 lens adjustment


    I rotated the lens in the anti-clockwise direction upto few degrees(upto 240 degrees) until I obtained a clear picture at a focal length of 4cm!

    Note: Try not to rotate the lens to maximum extent which may result in unscrewing of the lens from the module and dust may get collected inside preventing us to take perfect images.

    Testing

    Now plug in the module to the raspberry pi with  pre-installed Raspbian jesse OS and power up the Pi. If you are using it for the first time type user name as "pi" and password as "raspberry". Now open system configuration and enable camera. The system will reboot and after rebooting test whether the camera is able to take pictures.

    Image result for enabling raspberry pi cameraTo install the camera support enter the code in a terminal.

    sudo apt-get update
    sudo apt-get install python-picamera

    Now open a terminal and enter the following simple code to take a picture.

    import picamera
    camera = picamera.PiCamera()
    camera.capture('image.jpg')

    Now open the file explorer and check out the image how well it had been pictured.

    Related image

    Check out several features such as adjusting brightness and contrast to your image and even taking images using filters such as gray scale etc.. provided in the raspberry pi documentation.

    https://www.raspberrypi.org/documentation/usage/camera/python/README.md

    The hardware part is set up and lets place these in a suitable closed environment such that all the components are placed in a compact box and for better lighting conditions....

  • Testing of wheat flour sample

    G.Vignesh04/23/2017 at 18:29 0 comments

    Wheat flour is a powder made from the grinding of wheat used for human consumption. More wheat flour is produced than any other flour.[not verified in body] Wheat varieties are called "soft" or "weak" if gluten content is low, and are called "hard" or "strong" if they have high gluten content. Hard flour, or bread flour, is high in gluten, with 12% to 14% gluten content, and its dough has elastic toughness that holds its shape well once baked. Soft flour is comparatively low in gluten and thus results in a loaf with a finer, crumbly texture. Soft flour is usually divided into cake flour, which is the lowest in gluten, and pastry flour, which has slightly more gluten than cake flour.


    Type adulterant used and its testing


    Conventional method

    Chalk powder is the commonly used adulterant in the wheat flour. It can lead to several health problems such as diarrhea, stomach disorders etc. It is generally used by sellers to improve the quantity of the wheat flour and to bargain at a larger scale. There are several chemical / physical methods for testing. One such method has been listed below.

    Image result for wheat flour adulteration

    Proposed method

    Pure wheat flour sample is placed on a surface as a thin film and pictured.

    Thin film of pure wheat flour sample

    Then it is adulterated with 20% of chalk powder.

    The next step is to process these images and use it to compare with that of adulterated ones. Hence I used matlab software to process the images. The below image represents the high resolution image of the pure wheat sample.

    Pure wheat sample

    The below image represents the high resolution picture of adulterated sample.

    We can easily distinguish the some of the chalk powder substrates in the wheat flour sample when we take a closer look at the the above sample. Chalk powder is appears more whiter than the actual wheat flour sample.

    To compare this adulterated sample with that of the pure sample requires only few lines of code. First import the images in the Matlab software and in the command window type the below mentioned code.
    A = imread('A.jpg');
    B = imread('B.jpg');
    
    RA = imref2d(size(A),0.2,0.2);
    
    RB = imref2d(size(B),0.2,0.2);
    
    figure;
    
    hAx = axes;
    
    imshowpair(A,RA,B,RB,'Scaling','independent','Parent',hAx);
    This will provide a output image which can be able to find the differences between the images and to interpret the results quickly.

    The light purple colour patches indicates the darker regions/ highlighted regions that were present in pure sample image when compared to adulterated one. This effectively means that the adulterated chalk powder are indicated as purple patches. The green colour indicates the contrast of second image over the first one and it need not taken into account. So using the above image we can interpret that the wheat flour sample has been adulterated with 20% of chalk powder.


  • Getting started with image processing

    G.Vignesh04/23/2017 at 17:44 0 comments

    In imaging science, image processing is processing of images using mathematical operations by using any form of signal processing for which the input is an image, a series of images, or a video, such as a photograph or video frame; the output of image processing may be either an image or a set of characteristics or parameters related to the image.[1] Most image-processing techniques involve treating the image as a two-dimensional signal and applying standard signal-processing techniques to it. Images are also processed as three-dimensional signals with the third-dimension being time or the z-axis.

    Image processing usually refers to digital image processing, but optical and analog image processing also are possible.

    Image processing can also be used to find out the differences between two images. Hence it can be used to differentiate a sample from a pure one and can be used to analyze the results with ease. Before experimenting with the hardware & machine learning part, I have tried to analyze different samples of adulterated substances in a trial and error method. I have experimented by simply analyzing impure sample with that of a pure sample. There are lot of software that support image processing but right now I have used MATLAB R2017a version.

    Image result for matlab 2017a image processing


    This new version comes with extra features such as image enhancement, image segmentation,image transform, image analysis, geometric transformation and image registration, image processing and computer vision, feature extraction, stereo vision, optical flow, color profile, image analysis, image thresholding, edge detection, image registration, ransac, pattern recognition, affine transformation, lab color etc.

    Related image

    Image Processing Toolbox™ provides a comprehensive set of reference-standard algorithms and workflow apps for image processing, analysis, visualization, and algorithm development. One can perform image segmentation, image enhancement, noise reduction, geometric transformations, image registration, and 3D image processing.

    Image Processing Toolbox apps can be used to automate common image processing workflows. One can interactively segment image data, compare image registration techniques, and batch-process large data sets. Visualization functions and apps can be used to explore images, 3D volumes, and videos; adjust contrast; create histograms; and manipulate regions of interest (ROIs).

    We can easily accelerate algorithms by running them on multicore processors and GPUs. Many toolbox functions support C/C++ code generation for desktop prototyping and embedded vision system deployment.

View all 4 project logs

  • 1
    Step 1


    An overview of the whole process

View all instructions

Enjoy this project?

Share

Discussions

David H Haffner Sr wrote 06/23/2017 at 15:01 point

Very well written and informative project :)

  Are you sure? yes | no

Gautam Bhat wrote 04/11/2017 at 15:37 point

Using hyper spectral imaging the detection of adulteration of food
is very convincing. I have personally worked on it (on the surrounding electronics systems part not on the algorithms) and I have seen the results first hand.

If you are really serious about this IMEC is doing very good work on hyperspectral imaging. They have reference platforms available which you can try to integrate too. You can also search for videos on youtube using "imec hyperspectral imaging" which will give you the results what you are trying.


  Are you sure? yes | no

G.Vignesh wrote 04/11/2017 at 15:58 point

Thanks bro! But what I'm worried about  is the cost of hyper spectral camera
Is there any link that you could suggest me for buying hyperspectral camera

  Are you sure? yes | no

Gautam Bhat wrote 04/13/2017 at 15:45 point

Yes and no. You can check out Adimec. You can also ask for IMEC for their starter kits. Please mail them and see what happens.

  Are you sure? yes | no

David H Haffner Sr wrote 06/24/2017 at 08:18 point

Hey G.Vignesh, I  have a link for you over at Plab's website, it's a Mobias Camera that's right up UR alley; http://publiclab.myshopify.com/collections/diy-infrared-photography

Check it out, there are a number of individuals there who have used this HD camera set up with the filter pack and have had success with hyper spectral imagery.

  Are you sure? yes | no

Dylan Brophy wrote 04/11/2017 at 05:21 point

So basically this detects food containing "filler material"?  Aka, bad food.  Man, food is BAD in the U.S.  That would be SO useful for us.

  Are you sure? yes | no

G.Vignesh wrote 04/11/2017 at 09:57 point

Don't know much about finding filler material bro! I have personally experienced adulteration at smaller scales because I used to buy smaller quantities from wholesale products like 200 grams of wheat flour or chilly powder in market / stores unlike obtaining packaged products in UK USA etc

  Are you sure? yes | no

G.Vignesh wrote 04/11/2017 at 10:08 point

Anyways finding the quality of the substance becomes necessary. I think placing the sample before the camera and analysing it would be enough to find the solution for this type of problem and thats going to for the version 1.0 of this product!!! But finding out "filler material" is completely of the box for me bro!! :-P will try that one in the future :D

  Are you sure? yes | no

Dylan Brophy wrote 04/11/2017 at 13:10 point

OK, I think I understand the definition of 'adulterated' now.  Basically food unfit for consumption, correct?  That would be an interresting thing for a uC to detect. Cool!

  Are you sure? yes | no

G.Vignesh wrote 04/11/2017 at 02:45 point

Oh thanks for the info esot!!
Will check it out..

  Are you sure? yes | no

Jean Pierre Le Rouzic wrote 04/08/2017 at 07:33 point

Hi, this is a great project.
I understand that the picture is taken in the visible spectrum by a casual HD camera?
What do you think about adding some hardware to probe other characteristics, like polarization, IR and visible spectrum?

  Are you sure? yes | no

G.Vignesh wrote 04/08/2017 at 13:24 point

You are spot on sir! ;-) That's the idea sir... We are testing it with visible spectrum first for few compounds. But as you said earlier to find some adulterants (eg: honey) other spectra might be required because of polarization problems with visible spectra . I have done it for chilly powder and results were convincing!!

  Are you sure? yes | no

Corne van Kessel wrote 04/11/2017 at 09:47 point

Is the goal to use commonly available hardware? If so, testing with different spectra would be harder and lower the barrier to entry (as less readily available hardware is required). If not (and more advanced hardware is allowed) what about looking at hyperspectral imaging? One would be able to detect metamerism.

  Are you sure? yes | no

Jean Pierre Le Rouzic wrote 04/11/2017 at 10:52 point

I saw the answer from Corne van Kessel and it made me think about other low cost alternatives, for example:
* Inducing vibrations to detect density (and materials of different densities)
* Something similar to electrophoresis where small polarized molecules move quicker than larger ones.
The former solution requires a cup (may be with a non circular form) and a motor, the later is completely static and requires two electrodes, some time and a camera.
* But there are also low cost way to create spectrum information, because if you use ML you do not need narrow spectral lines, like you would require for signal processing. A simple grating is enough.

  Are you sure? yes | no

G.Vignesh wrote 04/11/2017 at 14:36 point

But searched for 50$ piece camera and found nothing. May be they've not released it in the market. All I could see is 1000$ worth cameras!!
The main cost of this project is aimed at around 150$-250$

  Are you sure? yes | no

Abhinav mukund wrote 04/04/2017 at 18:42 point

nice one......

  Are you sure? yes | no

Ember Leona wrote 04/02/2017 at 04:43 point

Try virus detection with that setup

  Are you sure? yes | no

G.Vignesh wrote 04/02/2017 at 17:32 point

How?

  Are you sure? yes | no

Ember Leona wrote 03/31/2017 at 22:35 point

you did it before had circuits with magnetic sand 3d monsters tabletop game and the feeling transmitter saw it in a cloud

  Are you sure? yes | no

G.Vignesh wrote 04/02/2017 at 02:58 point

Lol!

  Are you sure? yes | no

sachindraragul wrote 03/30/2017 at 16:04 point

Great use of digital signal processing!!

  Are you sure? yes | no

Yann Guidon / YGDES wrote 03/29/2017 at 22:04 point

How can I get one IBM Watson ? I'm not sure I can pay it, or even its electricity bills :-/

  Are you sure? yes | no

G.Vignesh wrote 03/30/2017 at 02:29 point

well the basic prototype is identifying adulteration  using Rpi & image processing technique. 

  Are you sure? yes | no

G.Vignesh wrote 03/30/2017 at 02:31 point

Since the final prototype/product requires high level Machine Learning technique to detect adulteration at any level, my idea is AI similar to that of IBM Watson could be used.

That AI should be cost effective also and I'm searching for similar kind!!!

Will update soon ;-)

  Are you sure? yes | no

Chikkanna678 wrote 03/24/2017 at 10:16 point

Phenomenal work ! Way to go !!

  Are you sure? yes | no

rajesh00754 wrote 03/23/2017 at 10:08 point

Super idea

  Are you sure? yes | no

vignesh95 wrote 03/23/2017 at 05:39 point

Excellent work sir.. Expecting this idea to win. 

  Are you sure? yes | no

mohammedzeeshan77 wrote 03/23/2017 at 05:29 point

Nice concept.. It would be of great help to various countries like INDIA.hats off for such ideas sir

  Are you sure? yes | no

G.Vignesh wrote 03/23/2017 at 05:59 point

This one is a major problem in the world. Hope people support this one so that I could really build that into a product.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates