Coder Social home page Coder Social logo

fediazgon / cone-detector-tf Goto Github PK

View Code? Open in Web Editor NEW
20.0 4.0 8.0 30.05 MB

Cone detector trained using the Tensorflow Object Detection API

License: MIT License

Python 100.00%
object-detection tensorflow-object-detection-api tensorflow single-shot-multibox-detector mobilenet ssd-mobilenet

cone-detector-tf's Introduction

project-logo
cone-detector-tf

Cone detector trained using the Tensorflow Object Detection API

RequirementsUsageModelLicense

project-demo

Requirements

Install the following packages with pip, preferably inside a virtual environment.

pip install opencv-python
pip install tensorflow

Usage

Run the program with the following command:

python cone_detector.py

Keep in mind that the app takes square crops for each frame in the video before performing the detection. This is because the model used has been trained using a pre-trained model from Tensorflow detection model zoo (ssd_mobilenet_v1_coco), whose input volume was a square image; and it performs much better after taking square crops.

However, if the video that you use has a different resolution you might want to change the size of the crops using the variables CROP_WIDTH, CROP_SIZE and CROP_STEP_X. If you don't want to take crops (the detection it is much faster but less accurate), uncomment the following lines:

# CROP_WIDTH = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
# CROP_HEIGHT = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
...
# crops = np.array([crops[0]])
# crops_coordinates = [crops_coordinates[0]]

Model

The model was trained using arround 200 images (70% train and 30% for validation) extracted from a longer version of the sample video, so it might perform worse on different images. If you want to finetune this model, you can find the .ckpt files in the model folder.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

cone-detector-tf's People

Contributors

fediazgon avatar thedanielz3 avatar

Stargazers

 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

cone-detector-tf's Issues

(WEB)cam use

I'm not able to get the code working with my webcam or external cam, is it possible to do it?
I tried the following without any results :

def main():
# Read TensorFlow graph
detection_graph = tf_utils.load_model(FROZEN_GRAPH_PATH)

# Read video from disk and count frames
cap = cv2.VideoCapture(0)

while(True):
# Capture frame-by-frame
ret, frame = cap.read()
fps = cap.get(cv2.CAP_PROP_FPS)

King in regards,

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.