GithubHelp home page GithubHelp logo

yolow-keras's Introduction

YOLOv2 Object Detection w/ Keras (in just 20 lines of code)

This repository presents a quick and simple implementation of YOLOv2 object detection using Keras library with Tensorflow backend. Credits goes to YAD2K Library on top of which this implementation was built.

cover01 cover02

Note that I do not hold ownership to any of the above pictures. These are merely used for educational purposes to describe the concepts.

Thoughts on the implementation

YOLO is well known technique used to perform fast multiple localizations on a single image.

A brief algorithm breakdown;

  • Divide the image using a grid (eg: 19x19)
  • Perform image classification and Localization on each grid cell -> Result, a vector for each cell representing the probability of an object detected, the dimensions of the bounding box and class of the detected image.
  • Perform thresholding to remove multiple detected instances
  • Perform Non-max suppression to refine the boxes more
  • Additionally anchor boxes are used to detect several objects in one grid cell
If you want to dive down into how these above points are implemented in the code refer yolo_eval function in the keras_yolo.py file from the yad2k/models directory.

Paper reference: YOLO9000: Better, Faster, Stronger by Joseph Redmond and Ali Farhadi.

Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano. It was developed with a focus on enabling fast experimentation. Being able to go from idea to result with the least possible delay is key to doing good research.

The use of keras helps to understand the concepts underling a ML technique by reducing the workload on coding. Thus, this implementation becomes a good platform for beginners to core concepts and have a quick implementation giving results.

Also for anyone who is looking to integrate object detection capabilities in applications, this code can be incorperated with a few lines of code.

Blog post on this: https://medium.com/@miranthaj/quick-implementation-of-yolo-v2-with-keras-ebf6eb40c684


Quick Start

  • Clone this repository to your PC

  • Download any Darknet model cfg and weights from the official YOLO website.

  • Convert the dowloaded cfg and weights files into a h5 file using YAD2K library. (This is explained step by step below in the more details section)

  • Copy the generated h5 file to the model_data folder and edit the name of the pretrained model in yolo.py code to the name of your h5 file.

  • Place the input image you want to try object detection in the images folder and copy its file name.

  • Assign your input image file name to input_image_name variable in yolo.py.

  • Open terminal from the repository directory directly and run the yolo.py file

    python yolo.py


More Details

How to convert cfg and weights files to h5 using YAD2k library (Windows)

  • Clone the YAD2K Library to your PC
  • Open terminal from the cloned directory
  • Copy and paste the downloaded weights and cfg files to the YAD2K master directory
  • Run python yad2k.py yolo.cfg yolo.weights model_data/yolo.h5 on the terminal and the h5 file will be generated.
  • Move the generated h5 file to model_data folder of the simpleYOLOwKeras directory

yolow-keras's People

Contributors

miranthajayatilake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yolow-keras's Issues

Apply yolo to video

can we apply this yolo on an video.
if yes can anyone help me how to do that

No bounding boxes

Thanx a lot for this repo

I downloaded this repo, but when i run the yolo.py file
the model did not detect any objects in the image

importing error while using latest version of pillow and python 3.11 version

Traceback (most recent call last):
File "e:\python project\project\ui\images.py", line 2, in
from PIL import ImageTk,Image
File "C:\Users\Sam\Anaconda3\lib\site-packages\PIL\ImageTk.py", line 31, in
from . import Image
File "C:\Users\Sam\Anaconda3\lib\site-packages\PIL\Image.py", line 89, in
from . import _imaging as core
ImportError: DLL load failed while importing _imaging: The specified module could not be found.

I am getting an error while importing Image from PIL

Traceback (most recent call last):
File "yolo.py", line 7, in
from PIL import Image
File "C:\Users\P V\Anaconda3\lib\site-packages\PIL\Image.py", line 58, in
from . import _imaging as core
ImportError: DLL load failed: The specified module could not be found.

Can I know where is the problem

error: No module named 'yad2k'

Thanks for this repository.
I got an error with this phrase: from yad2k.models.keras_yolo import yolo_head, yolo_eval
ModuleNotFoundError: No module named 'yad2k'

Do I need a preliminary step and install something before I run the yolo.py code?

help me fix error

yolo.py line 59
ValueError cannot feed value of shape (1,608,608,3) for the tensor input1 which has shape (?,416,416,3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.