
































Microsoft Word - 63-full article-139-1-2-20210511


         American Journal of Agricultural Science, Engineering and Technology 
 

 ISSN: 2158-8104 (Online), 2164-0920 (Print), 2021, Vol. 5, Issue.1 
http://journals.e-palli.org 

 



         American Journal of Agricultural Science, Engineering and Technology 
 

 ISSN: 2158-8104 (Online), 2164-0920 (Print), 2021, Vol. 5, Issue.1 
http://journals.e-palli.org 

The American Journal of Agricultural Science, Engineering and Technology (AJASET) is 
blind peer reviewed international journal publishing articles that emphasize research, 
development and application within the fields of agricultural science, engineering and 
technology. The AJASET covers all areas of Agricultural Science, Engineering and 
Technology, publishing original research articles. The AJASET reviews article within 
approximately two weeks of submission and publishes accepted articles online immediately 
upon receiving the final versions.  

Published Media: ISSN: 2158-8104 (Online), 2164-0920 (Print).  

Frequency: 2 issues per year (January, July)  

Area of publication: Agricultural Science, Engineering and Technology. The subjects 
covered by the journal includes but not limited to:  

 

Agriculture 
Agricultural Economics and Agri-business  
Agricultural Engineering  
Agricultural Statistics  
Agricultural Extension and Development 
Agro-forestry and Ecotourism  
Agronomy  
Agro-tourism  
Animal Science and Nutrition  
Applied Agriculture  
Applied Economics and Finance 
Aquaculture  
Bioinformatics  
Biotechnology and Biochemistry Climate 
Change and Green Technology 
Collaborative Engineering  
Computer Science and Engineering 
Computational Biology  
Crop Science and Production  
Dairy Science & Poultry Science Decision 
Support System  
Entomology  
Environmental Science and Extension 

Dental and Medical Science  
Experimental Agriculture  
Food science, Engineering and 
Technology Genetics Technology  
Geophysics  
GIS, GPS, and Remote Sensing 
Horticultural Science  
ICT for Agricultural Development  
Irrigation and Water Resource Engineering 
Land Use and Development  
Mathematics  
Modeling of Crop and Animal System 
Pathology and Plant Protection  
Fisheries  
Plant Breeding and Crop Science  
Post-harvesting Technique and 
Technology Precision Agriculture  
Production Engineering  
Social Science and Agricultural 
Development Soil Science  
Tropical Agriculture  
Veterinary Science and Technology 



         American Journal of Agricultural Science, Engineering and Technology 
 

 ISSN: 2158-8104 (Online), 2164-0920 (Print), 2021, Vol. 5, Issue.1 
http://journals.e-palli.org 

EDITORIAL BOARD 

 

Chief Editor 

Dr Mamun-Or-Rashid 

Professor, Dhaka University, Bangladesh 

 

Board Members  

Dr. Sumit Garg, IL, USA 

Professor Dr. James J. Riley, The University of Arizona, USA 

Dr. Ekkehard KÜRSCHNER, Agriculture Development Consultant, Germany 

Professor Dr. Rodriguez Hilda, USA 

Professor Dr. Michael D. Whitt, USA 

Professor Dr. Wael Al-aghbari, Yemen 

Dr. Clement Kiprotich Kiptum, University of Eldoret, Kenya 

 

Managing Editor 

Md. Roshidul Hasan 

Professor, Department of Computer Science and Information Technology,  
Bangabandhu Sheikh Mujibur Rahman Agricultural University

 

 

 

 

 

 

 

 



         American Journal of Agricultural Science, Engineering and Technology 
 

63 ISSN: 2158-8104 (Online), 2164-0920 (Print), 2021, Vol. 5, Issue.1 
http://journals.e-palli.org 

A MACHINE LEARNING-BASED PRICE PREDICTION FOR COWS 

Md Atiquer Rahman1 , Md Alamgir Kabir2 , Md. Ezazul Haque3, B M Mainul Hossain4 

Institute of Information Technology, University of Dhaka, Dhaka, Bangladesh 

DOI: http://doi.org/10.5281/zenodo.4817941  

ABSTRACT 
As Bangladesh is an agricultural country, cows have a great influence on our economy. 
However, there is no cow-related work or dataset accessible online in the fields of machine 
learning and artificial intelligence. This study aims to predict cow price ranges using any cow 
picture. Cow images were collected from different online e-commerce sites which are selling 
cows and mainly attempted to predict the price range of cows based on the images of the 
cows. Cows are divided into four classes based on their price range namely low, medium, 
high, and very high classes. A machine learning-driven approach has been taken for the 
prediction where convolutional neural network (CNN) is used as an image classifier and 
linear regression is used for predicting the prices. Our result shows that the price range of a 
cow can be predicted with an accuracy of 70%. 

 
14th Year Student, Institute of Information Technology, University of Dhaka, Dhaka, 
Bangladesh; Email: bsse0908@iit.du.ac.bd 
24th Year Student, Institute of Information Technology, University of Dhaka, Dhaka, 
Bangladesh; Email: bsse0907@iit.du.ac.bd 
34th Year Student, Institute of Information Technology, University of Dhaka, Dhaka, 
Bangladesh; Email:bsse0923@iit.du.ac.bd 
4Associate Professor, Institute of Information Technology (IIT),University of Dhaka, 
Bangladesh; Email: mainul@iit.du.ac.bd 

 

 

 

 

 

 

 

 

 

 

 

 

 



         American Journal of Agricultural Science, Engineering and Technology 
 

64 ISSN: 2158-8104 (Online), 2164-0920 (Print), 2021, Vol. 5, Issue.1 
http://journals.e-palli.org 

1. INTRODUCTION 

Price prediction is difficult regarding the complex behavior of price signaling and datasets. 
But it has a great socioeconomic value. Almost 80% of people in our country Bangladesh live 
in rural areas. As they live in villages, they mainly depend on agriculture for their livelihoods. 
That’s why cows are the most domestic animal in almost every house in the village. On the 
other hand, Bangladesh is a Muslim-majority country with significant demand for cows. So, 
cows have a great impact on the economy. People who are unaware of the price of cows, on 
the other hand, are often defrauded when selling and purchasing cows. So, a tool that predicts 
the cows’ prices can be helpful to know about the prices of cows before selling and buying 
and the chance of deception will be reduced. Therefore, this work aims to predict the price of 
cows according to the image. Along with the images, some other attributes have also been 
considered.Predict of price is always a tough task. Here, the prediction of livestock like a 
cow’s price class is more difficult than other price prediction tasks. A lot of works has 
already been done by machine learning engineers for price predictions such as stock price 
prediction, house price prediction, beef meat price, etc. from the images using in CNN. But a 
few works on cattle price prediction. In this paper cows' price range will be predicted. S. U. 
Rehman proposed an unsupervised CNN architecture for face image classification. By 
combining CNN with other modules and algorithms, a CNN capable of multitasking (e.g., 
facial detection and emotional classification) is developed. N. Jain et al. proposed a hybrid 
deep CNN and RNN (Recurrent Neural Network) model. The aim of this model is to improve 
the overall performance of image category detection. ConvNets can learn these 
channels/highlights with satisfactory preparation. Although some papers advocate for the use 
of unsupervised CNN, supervised learning is more suitable for this initiative. 

 
2. METHODOLOGY 
Firstly, a dataset is created by web scraping, then we preprocessed the dataset for 
implementing the algorithms. Then used CNN and Linear regression to predict the price. The 
detail is as follow, 

2.1 Background 

CNN 

A Convolutionary Neural Arrange (ConvNet / CNN) may be a Profound Learning algorithm, 
which permits an input picture to require on diverse viewpoints / objects and can be 
recognized from one picture (learnable weights and inclinations). ConvNet requires much 
less preprocessing than other classification calculations. Whereas the channels are hand-made 
in primitive strategies, ConvNets can learn these channels / highlights with adequate training. 
The ConvNet design is comparable to that of neurons within the human brain and was 
impacted by the Visual Cortex association. Inside a restricted region of the visual eld known 
as the Open Field, as it where person neurons react to jolts. The whole visual zone is secured 
by a choice of these areas. 

 

 

 

 



         American Journal of Agricultural Science, Engineering and Technology 
 

65 ISSN: 2158-8104 (Online), 2164-0920 (Print), 2021, Vol. 5, Issue.1 
http://journals.e-palli.org 

Modules 

NUMPY, PANDAS, MATPLOTLIB, OS, PIL, TENSORFLOW, Ktrain modules are used in 
this work. 

Data Collection & Processing 

Price range detection is the process of automatically discerning the price of a cow solely from 
a photo of its full body. Typically, you’ll see price detection implemented as a three-stage 
process:  

Stage 1: Data Collection via web scraping 

Stage 2: Data processing adding cow price added in cow image path Converting images into   
256 

Stage 3: Extract the price Region of Interest (ROI), and apply the price predictor algorithm to 
predict the price of the cow. 

There are 6 features(image,height,age,color,class) in the database and one dependent 
variable(price). First cow price is added in the cow image path so that a relationship between 
cow price and cow images can be built. Finally add four features(height, age, teeth, and 
color) inside the image header. Divide the whole database into the train (80%) and test (20%) 
datasets. Then pass images in CNN. Color is an example of a categorical attribute. As a 
result, color was used after encoding. Here, mainly tried to predict the price range of cows 
according to the images of the cows. Four classes are defined based on their price range. Low 
(price <75000 taka), medium(75000<price≤150000), high(150000<price≤250000) and very 
high (price>250000) class. 

Image Processing 

Image processing is a technique of performing operations on an image in order to improve it 
or obtain valuable information from it. This is a method of signal processing in which taking 
an image as input, and giving outputs as an image or some features. Reading image from 
dataframe, keeping inside 3D array (256,256,3) and scale image pixel value into 0 to 1. Then 
all images divide into three sets train images, test images, validation images. 

Price Prediction With CNN 

CNN algorithm is used for price range prediction. Some interdependent procedures are 
followed step by step. It is discussed in the below points.First,changing the current directory 
to the path where image dataset is been stored and then listing  the files and directories in the 
specified path and adding cow price inside cow image path.Reading database from csv. Split 
database into train and test datasets. Processing images from path and convert them into 
252x252x3 arrays and scaling pixel values into 0 to 1. Adding others features height; age; 
teeth; color, with image array. Finally, 256*256*3 array is formed. Building CNN model. 
adding Conv2D layer with 16 size and 3*3 kernel size, Relu activation layer and MaxPool2D. 
adding Second Conv2D layer with 32 size and 3*3 kernel size ,Relu activation layer and 
MaxPool2D.Adding 2 Dense layer with size 64.Finally adding output layer with input size 
1.In this work, Keras is used and it supports CNN. Fit model with train data and validation 
data. 



         American Journal of Agricultural Science, Engineering and Technology 
 

66 ISSN: 2158-8104 (Online), 2164-0920 (Print), 2021, Vol. 5, Issue.1 
http://journals.e-palli.org 

2.2 Dataset 

There is no existing dataset. A dataset is created for this work. Library named 
beautiful soup is used for parsing HTML and XML documents including markups, 
non-closed tags. It builds a parse tree for parsed pages that are used for extracting 
data from HTML, which makes web scraping easier. Data sourcing websites are 
“amardeshshop.com" and "goruchai.com" which are e-commerce websites. Then 
decipher the information in URLs. After that links are sorted which information is 
used mainly needed. Then parse HTML code with beautiful soup. We make a CSV 
le with six columns. (cow id,image,height,age,teeth,color). The total length of a 
dataset is 931, out of which 596 is used for training,187 for testing, and 148 for 
validating the data. One valid image had a shape (256,256,3). We divided the cows 
into four categories based on price range [Low, Medium, High,Very High]. 

Figure 1: Classes 
 

Training Dataset: The training dataset is used as a set of examples used for training a 
model. 80% of data from dataset is chosen randomly for training the model.  

Validation Dataset: A validation dataset helps in the reduction of overfitting.20% of 
training dataset is chosen for validation. 

Test Dataset: The test data collection is used to evaluate the classification or model 
results and verify the performance of features such as precision, failure, sensitivity 
and so on. It is independent of the training and validation dataset. 20% of data from 
dataset is chosen randomly for testing the model.  

  



         American Journal of Agricultural Science, Engineering and Technology 
 

67 ISSN: 2158-8104 (Online), 2164-0920 (Print), 2021, Vol. 5, Issue.1 
http://journals.e-palli.org 

3. RESULT ANALYSIS 

To get result, a user has to input a cow’s height, age, teeth, color, and cow image. Input 

image size must be 256x256 pixels. The model can then predict the price class of a cow. 

Here are some samples of the output result. 

 

Actual Price: 350000 taka 
Actual Class: High 

  

  

Actual Price: 158000 taka 
Actual Class: Medium 

 

 Actual Price: 58000 taka 
Actual Class: Low 

 

 Actual Price: 730000 taka 
Actual Class: Very High 

 

 

 
 

 



         American Journal of Agricultural Science, Engineering and Technology 
 

68 ISSN: 2158-8104 (Online), 2164-0920 (Print), 2021, Vol. 5, Issue.1 
http://journals.e-palli.org 

This work has an accuracy of 70.05%, its precision is 68.69%, recall is 70.05% and the F1 
score is 65.73%. The accuracy level can be increased when the dataset will be increased. 

 

CONCLUSION 
 
In this paper, a model is proposed to perform price class estimation based on cows’ images 
by using the image classifier CNN (convolutional neural network). Almost 1000 data points 
from different websites related to cows are collected for this process. Most of the data points 
are taken from the website "goruchai.com". 80% of data as training and 20% of data as 
testing purposes. This study shows an accuracy of 70%. 

 

REFERENCES 

A. Dehghan, E. G. Ortiz, G. Shu, S. Z. Masood, DAGER: deep age, gen-der and 
emotion recognition using convolutional neural network, CoRR 
abs/1702.04280. arXiv:1702.04280.  

 URL http://arxiv.org/abs/1702.04280 
 
A. Krizhevsky, I. Sutskever, G. E. Hinton, Imagenet classi cation with deep 

convolutional neural networks, Commun. ACM 60 (6) (2017) 84{90. 
doi:10.1145/3065386. URL https://doi.org/10.1145/3065386 

 
G. Xu, China gold futures price prediction model-from the perspective of the gray 

prediction, in: 2011 2nd International Conference on Arti cial 
Intelligence, Management Science and Electronic Commerce 
(AIMSEC), 2011, pp. 5479{5482.  

 doi:10.1109/AIMSEC.2011.6009808. 
 
H. Ebrahimian, S. Barmayoon, M. Mohammadi, N. Ghadimi, The price prediction 

for the energy market based on a new method, Economic Research-
Ekonomska Istrazivanja 31 (1) (2018) 313{337.  

 arXiv:https://doi.org/10.1080/1331677X.2018.1429291,  
 doi:10. 1080/1331677X.2018.1429291.  
 URL https://doi.org/10.1080/1331677X.2018.1429291 
 
H. Liu, B. Song, Stock price trend prediction model based on deep resid-ual network 

and stock price graph, in: 2018 11th International Sympo-sium on 
Computational Intelligence and Design (ISCID), Vol. 02, 2018, pp. 
328{331. doi:10.1109/ISCID.2018.10176. 

 
I. Parmar, N. Agarwal, S. Saxena, R. Arora, S. Gupta, H. Dhiman, L. Chouhan, Stock 

market prediction using machine learning, in: 2018 First International 
Conference on Secure Cyber Computing and Com-munication 
(ICSCCC), 2018, pp. 574{576. doi:10.1109/ICSCCC.2018. 8703332. 

 



         American Journal of Agricultural Science, Engineering and Technology 
 

69 ISSN: 2158-8104 (Online), 2164-0920 (Print), 2021, Vol. 5, Issue.1 
http://journals.e-palli.org 

J. Mu, F. Wu, A. Zhang, Housing value forecasting based on machine learning 
methods, Abstract and Applied Analysis 2014 (2014) 648047. 
doi:10.1155/2014/648047. URL https://doi.org/10.1155/2014/648047 

 
L. Bork, S. V. M ller, Forecasting house prices in the 50 states using dynamic model 

averaging and dynamic model selec-tion, International Journal of Forecasting 
31 (1) (2015) 63{78. doi:https://doi.org/10.1016/j.ijforecast.2014.05.005. URL: 
https://www.sciencedirect.com/science/article/pii/ S0169207014000958 

Mahsa Mir, House prices prediction using deep learning, Tech. rep. (2020). 
 
M. Ahtesham, N. Z. Bawany, K. Fatima, House price prediction using machine 

learning algorithm - the case of karachi city, pakistan, in: 2020 21st 
International Arab Conference on Information Technology (ACIT), 
2020, pp. 1{5. doi:10.1109/ACIT50332.2020.9300074. 

 
N. Srinivas, H. Atwal, D. C. Rose, G. Mahalingam, K. Ricanek, D. S. Bolme, Age, 

gender, and ne-grained ethnicity prediction using convo-lutional neural 
networks for the east asian face dataset, in: 2017 12th IEEE 
International Conference on Automatic Face Gesture Recognition (FG 
2017), 2017, pp. 953{960. doi:10.1109/FG.2017.118. 

 
P.-Y. Wang, C.-T. Chen, J.-W. Su, T.-Y. Wang, S.-H. Huang, Deep learning model 

for house price prediction using heterogeneous data anal-ysis along 
with joint self-attention mechanism, IEEE Access 9 (2021) 
55244{55259. doi:10.1109/ACCESS.2021.3071306. 

 
S. Rehman, S. Tu, Y. Huang, Z. Yang, Face recognition: A novel un-supervised 

convolutional neural network method, 2016, pp. 139{144. 
doi:10.1109/ICOACS.2016.7563066. 

 
S. S. V. K. Ishita Verma, Urvi Marhatta, Age prediction using im-age dataset using 

machine learning, International Journal of Innovative Technology and 
Exploring Engineering (IJITEE) 8 (2019) 107{113}. 

 
Z. Qawaqneh, A. A. Mallouh, B. D. Barkana, Deep convolutional neural network for 

age estimation based on vgg-face model (2017). arXiv: 1709.01664. 


