Code Monkey home page Code Monkey logo

tf-object-detection's Introduction

Scope

This repo is aiming to provide production ready 2D object detection code basics.

It's based on official tensorflow API jupyter notebook but I will gradually add more popular models such as yolo series.

More

If you are interested in 3D object detection, visit this repo.

If you are interested in Segmentation, visit this repo.

Introduction

This is a repo for implementing object detection with pre-trained models (as shown below) on tensorflow.

Model name Speed COCO mAP Outputs
ssd_mobilenet_v1_coco fast 21 Boxes
ssd_inception_v2_coco fast 24 Boxes
rfcn_resnet101_coco medium 30 Boxes
faster_rcnn_resnet101_coco medium 32 Boxes
faster_rcnn_inception_resnet_v2_atrous_coco slow 37 Boxes

Dependencies:

  • Tensorflow >= 1.2.0
  • OpenCV

Run Demo

# Clone this repo
git clone https://github.com/KleinYuan/tf-object-detection.git

# Setting up
cd tf-object-detection
bash setup.sh

# Run demo
python app.py

res

Image Classifications

I also put an image classifications inference app (VGG16) here.

# Assuming you already run setup.sh, which will download vgg16.np

python app_ic.py

Networks

Model name Architecture
AlextNet AlexNet
Vgg 16 VGG16
SSD SSD
ResNet Resnet
MobileNet MobileNet
Faster R-CNN fasterrcnn

tf-object-detection's People

Contributors

kleinyuan 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tf-object-detection's Issues

Port to Python 3

Can i use it on python 3?
When i run on python 3 after changing print in object_detection.py initially it showed this error

File "tf-object-detection\lib\label_map_util.py", line 22, in
import string_int_label_map_pb2
ImportError: No module named 'string_int_label_map_pb2'

To FIX it, I changed this line in object_detection.py
import label_map_util
to
import lib.label_map_util

and in label_map_util.py
import string_int_label_map_pb2
to
from lib import string_int_label_map_pb2

NOW I HAVE FOLLOWING PROBLEM

File "/tf-object-detection-master/models/object_detection.py", line 122, in predict
for i in range(0, num_detections):

TypeError: only integer scalar arrays can be converted to a scalar index

I am using model number 2 ie ssd_inception_v2_coco_11_06_2017 and getting no detections on test image.
Any help is appreciated in running it for python 3

Tensorflow Object Detection API

Hey, I think this needs the Tensorflow Object Detection API as a dependency as well. Can you include instructions on how to install that?

cannot connect to X server

i have this error when i run sudo python app.py
i added the line: Defaults env_keep="DISPLAY XAUTHORITY" at the end of visudo but i still have this error

No module named 'string_int_label_map_pb2

python app.py
Traceback (most recent call last):
File "app.py", line 1, in
from models import object_detection
File "/home/kmh/Desktop/han/obj/t1/tf-object-detection/models/object_detection.py", line 7, in
import lib.label_map_util
File "/home/kmh/Desktop/han/obj/t1/tf-object-detection/lib/label_map_util.py", line 22, in
import string_int_label_map_pb2
ImportError: No module named 'string_int_label_map_pb2'

i got an issue
icant handle this problem
what do i do?

FPS Calculation Bug

I am getting negative values to the FPS using the object_detection program.

I think it is related to calculating the time difference with datetime.datetime.now().microsecond * 0.001

It can be solves using datetime.datetime.now().utcnow() i think, or using other module to calculate the fps rate like 'timeit' package.

Your code is clean and a good wrapper to the tensorflow object detection module.

Cheers!

hi,i am coming again..this time ,i want to seek advice from another ssd train process..hope for your save

the link is https://github.com/balancap/SSD-Tensorflow , and I follow the introduce to make my tfrecord, for a simple try, I use one class ,and got 13 tfrecords, but , may be there are too much place I shoud to modify ,I do not know how should I do .Beginning ,I did not modify anywhere in train_ssd_network.py,and things go likely, later I modify the num_classes to 1 from 21,things to be bad. and cant go on. The traing_config.txt Is
`

===========================================================================

Training | Evaluation flags:

===========================================================================

{'adadelta_rho': 0.95,
'adagrad_initial_accumulator_value': 0.1,
'adam_beta1': 0.9,
'adam_beta2': 0.999,
'batch_size': 16,
'checkpoint_exclude_scopes': None,
'checkpoint_model_scope': None,
'checkpoint_path': './checkpoints/ssd_300_vgg.ckpt/ssd_300_vgg.ckpt',
'clone_on_cpu': False,
'dataset_dir': '/home/wuchunsheng/project/detection_task/data/gesture_1',
'dataset_name': 'pascalvoc_2012',
'dataset_split_name': 'train',
'end_learning_rate': 0.0001,
'ftrl_initial_accumulator_value': 0.1,
'ftrl_l1': 0.0,
'ftrl_l2': 0.0,
'ftrl_learning_rate_power': -0.5,
'gpu_memory_fraction': 0.7,
'ignore_missing_vars': False,
'label_smoothing': 0.0,
'labels_offset': 0,
'learning_rate': 0.001,
'learning_rate_decay_factor': 0.94,
'learning_rate_decay_type': 'exponential',
'log_every_n_steps': 10,
'loss_alpha': 1.0,
'match_threshold': 0.5,
'max_number_of_steps': None,
'model_name': 'ssd_300_vgg',
'momentum': 0.9,
'moving_average_decay': None,
'negative_ratio': 3.0,
'num_classes': 21,
'num_clones': 1,
'num_epochs_per_decay': 2.0,
'num_preprocessing_threads': 4,
'num_readers': 4,
'opt_epsilon': 1.0,
'optimizer': 'adam',
'preprocessing_name': None,
'rmsprop_decay': 0.9,
'rmsprop_momentum': 0.9,
'save_interval_secs': 600,
'save_summaries_secs': 60,
'train_dir': '/home/wuchunsheng/project/detection_task/data/gesture_1',
'train_image_size': None,
'trainable_scopes': None,
'weight_decay': 0.0005}

===========================================================================

SSD net parameters:

===========================================================================

{'anchor_offset': 0.5,
'anchor_ratios': [[2, 0.5],
[2, 0.5, 3, 0.3333333333333333],
[2, 0.5, 3, 0.3333333333333333],
[2, 0.5, 3, 0.3333333333333333],
[2, 0.5],
[2, 0.5]],
'anchor_size_bounds': [0.15, 0.9],
'anchor_sizes': [(21.0, 45.0),
(45.0, 99.0),
(99.0, 153.0),
(153.0, 207.0),
(207.0, 261.0),
(261.0, 315.0)],
'anchor_steps': [8, 16, 32, 64, 100, 300],
'feat_layers': ['block4', 'block7', 'block8', 'block9', 'block10', 'block11'],
'feat_shapes': [(38, 38), (19, 19), (10, 10), (5, 5), (3, 3), (1, 1)],
'img_shape': (300, 300),
'no_annotation_label': 21,
'normalizations': [20, -1, -1, -1, -1, -1],
'num_classes': 21,
'prior_scaling': [0.1, 0.1, 0.2, 0.2]}

===========================================================================

Training | Evaluation dataset files:

===========================================================================

['/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_000.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_001.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_002.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_003.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_004.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_005.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_006.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_007.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_008.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_009.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_010.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_011.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_012.tfrecord',
'/home/wuchunsheng/project/detection_task/data/gesture_1/voc_2012_train_013.tfrecord']

`
can you point me where should I pay more attentions and what shoud I modify ,thank you ,and hope for your help.

TypeError: only integer scalar arrays can be converted to a scalar index

python app.py

Traceback (most recent call last):
File "app.py", line 43, in
demo(mode=STATIC_MODE)
File "app.py", line 20, in demo
net.predict(img=img, display_img=img)
File "/Users/nick/Documents/google_drive/doing/object_detection/tf-object-detection/models/object_detection.py", line 118, in predict
for i in range(0, num_detections):
TypeError: only integer scalar arrays can be converted to a scalar index

i got this error ,plz help

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.