Object Detection Using Python with Source Code


Object Detection is one the best artificial intelligence work done by computer to read and analyze the moving data/object. Detecting an object is a very simple thing but using artificial intelligence is a tough one. We need hundred and thousands of data to approve it 100% for the excellence result.

Object Detection is a technology  which is related to image processing and vision that deals with detecting and recognizing images like cars, dog, person, house, and many more. The detection of any object nearby includes digital and analog signals and processing. Also, detection of any object is done through an algorithm which consists of bunch of computer codes.

Also detection of an object is consist of machine learning and deep learning algorithm, which helps to produce automated machine produced data.

Background Reading

Object Detection using python is a very simple and convenient way to building an AI project. There are lots of data are installed and called, which are trained using Machine learning algorithm. This project uses YOLO algorithm for object detection and for training model.

YOLO algorithm is a latest one after opencv2, it gives more excellent result and is easy to import and add.

And Training a model

Training is simple as you only have to add option --train. Training set and annotation will be parsed if this is the first time a new configuration is trained. To point to training set and annotations, use option --dataset and --annotation. A few examples:

# Initialize yolo-new from yolo-tiny, then train the net on 100% GPU:
flow --model cfg/yolo-new.cfg --load bin/yolo-tiny.weights --train --gpu 1.0

# Completely initialize yolo-new and train it with ADAM optimizer
flow --model cfg/yolo-new.cfg --train --trainer adam

During training, the script will occasionally save intermediate results into Tensorflow checkpoints, stored in ckpt/. To resume to any checkpoint before performing training/testing, use --load [checkpoint_num] option, if checkpoint_num < 0darkflow will load the most recent save by parsing ckpt/checkpoint.

# Resume the most recent checkpoint for training
flow --train --model cfg/yolo-new.cfg --load -1

# Test with checkpoint at step 1500
flow --model cfg/yolo-new.cfg --load 1500

# Fine tuning yolo-tiny from the original one
flow --train --model cfg/yolo-tiny.cfg --load bin/yolo-tiny.weights

Technologies used

  • Py Camera for detection an object.
  • Pycharm as an IDE.
  • Python as a programming language.
  • Raspberry PI 3 as a micro controller.
  • Python Library
  • tensorflow 1.0, numpy, opencv 3.


  • Moreover, face detection in python detects face with both black and white and RGB color.
  • It is very fast and easy detects any objects near by.
  • Easy to use in Raspberry PI 3.
  • Also, it is compatible with Python language.
Object Detection

Object Detection


  • This object detection detects any near by object in an instant.
  • Also, python language is a easy language to understand and built, so this will help to expand this project.
  • Similarly, it is portable and handy gadget.

Therefore things to know

  • Likewise, Open-CV: Open-CV provides building blocks for computer software, testing and vision because it is an open source library of Python.
  • Also, Sys: Sys is a Python library that is use for Python run time environment by providing a number of variables and functions
  • Time: This Time library of Python is use to show date and time of current situation.
  • PIL (Python Image Library): To provide support for saving, creating and manipulating several image file formats.
  • Therefore, YOLO library for deep learning.


Therefore click on below button to download this project

Thank you,

Credit: Siraj Rival

0 0 vote
Article Rating

You may also like...

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x