Professional Documents
Culture Documents
PDF 20230627 094939 0000
PDF 20230627 094939 0000
IMAGE
PROCESSING
FRUIT DETECTION REPORT
Prepared by:MAHESH
2021UGECE36
02
ABSTRACT
A new method for classifying fruits using image processing
technique is proposed in this paper. The data set used had 70
apple images and 70 banana images for training and 25 images
of apple and 25 images of bananas for testing. RGB image was
first converted to HSI image. Then by using Otsu's thresholding
method region of interest was segmented by taking into account
only the HUE component image of the HSI image. Later, after
background subtraction, a total of 36 statistical and texture
features were extracted with the help of the coefficients
obtained by applying wavelet transformation on the segmented
image using Haar filter. Extracted features were given as inputs
to a SVM classifier to classify the test images as apples and
bananas. As KNN classification method did not give 100%
accuracy while classification SVM classification method was
used. 140 sample images of apples and bananas were used for
training and 25 images of banana and 25 images of apples were
used for testing the proposed algorithm. The proposed algorithm
gave 100% accuracy rate.
02
Introduction
In recent years, advanced agricultural automation has increased
productivity by reducing production costs and manual labor
while increasing yield and quality [1]. However, many tasks are
still completed manually and limitations exist in automating tasks
on a large scale.
The main motivation and uses for this project are:
• Decrease food waste by identifying rotten fruit in a batch
at an early stage to prevent spreading to other fruits during
transportation or storage. Can be employed at large
agricultural scales and also at local grocery stores when
receiving new fruit stock.
• Increase efficiency at the agricultural level by automating
the prediction of fruit states and therefore optimizing
harvests • Identifying fruit with a network can ease
cashiers’ jobs when processing fruit as currently cashiers
need to remember serial codes to input into the register
(minimizing human computer interactions)
03
LITERATURE
SURVEY
Before the recent machine learning (ML) advances, the main
approach for fruit state identification was with OpenCV and
image segmentation, which produced decent results but has
limitations. Recently ML approaches for quality of fruit
identification have been investigated by many researchers,
resulting in papers regarding feature analysis, architecture
choice, and reframing fruit feature detection as an image
segmentation problem (i.e fruit vs. background) [5-7]. Upon
further research, we have found that the use of a CNN model
outperforms non ML computer vision approaches
Illustration/Figure
05
RESULTS AND
DISCUSSIONS
05
RESULTS AND
DISCUSSIONS
05
CONCLUSION
05
CODE
import numpy as np
from keras.preprocessing.image import load_img,
img_to_array
from keras.models import load_model
from flask import Flask, jsonify, request
model = load_model('FV.h5')
app = Flask(_name_)
@app.route('/predict', methods=['POST'])
def infer_image():
if 'file' not in request.files:
return jsonify(error="Please try again. The Image doesn't exist")
file = request.files.get('file')
img_bytes = file.read()
img_path = "./upload_images/test.jpg"
with open(img_path, "wb") as img:
img.write(img_bytes)
result = prepare_image(img_path)
return jsonify(prediction=result)
if _name_ == '_main_':
app.run(debug=False, host='0.0.0.0'
05
REFERENCES
https://www.bing.com/search?
pglt=41&q=python+online+compiler&cvid=54a743eb079
045c3a7dc56bb3db12672&aqs=edge.2.69i57j0l8.6491j0
j1&FORM=ANNTA1&PC=HCTS
https://codewithcurious.com/projects/
https://stackoverflow.com/questions/46610689/how-
to-import-cv2-in-python3