Giter Club home page Giter Club logo

imageai's Issues

Coordinates

Hello,
amazing project, my compliments. I have two 'simple' questions:
1)There is any way so I can determine the coordinates above the image of the detected model?

  1. If I would like to make detection above greyscale images?

Thank you

imageAi-Input shape

Hi,

Thank you for the great work!

the model resnet50_coco_best_v2.1.0.h5 was trained. but when we load model that we can choose prediction_speed as {normal、fast、faster、fastest}.so that the model input_shape will be changed.
But Using convolution layer as the first layer in a model, should provide an input_shape argument when we trained model with keras.

Could someone inform me?

thank you in advance

CustomPrediction Exception

I run the FirstCustomPrediction.py code , and get the exception . The model file path and json file path is correct

Traceback (most recent call last):
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Prediction\Custom_init_.py", line 385, in loadModel
model = ResNet50(model_path=self.modelPath, weights="trained", model_input=image_input, num_classes=self.numObjects)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Prediction\ResNet\resnet50.py", line 111, in ResNet50
model.load_weights(weights_path)
File "C:\Users\admin\Anaconda3\lib\site-packages\tensorflow\python\keras_impl\keras\engine\topology.py", line 1101, in load_weights
f = h5py.File(filepath, mode='r')
File "C:\Users\admin\Anaconda3\lib\site-packages\h5py_hl\files.py", line 271, in init
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "C:\Users\admin\Anaconda3\lib\site-packages\h5py_hl\files.py", line 101, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (Truncated file: eof = 78022201, sblock->base_addr = 0, stored_eof = 94851792)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:/tensorflow/pyimages/day2-object-detect/train_test/test.py", line 14, in
prediction.loadModel(num_objects=10)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Prediction\Custom_init_.py", line 389, in loadModel
raise ValueError("You have specified an incorrect path to the ResNet model file.")
ValueError: You have specified an incorrect path to the ResNet model file.

Detection raises a ValueError

Hi,

I'm trying to run the object detection on a Mac machine but getting an error.
The libraries and their versions are up to date:

  • python 3.6.4_3
  • tensorflow 1.8.0
  • numpy 1.14.1
  • scipy 1.0.0
  • opencv-python 3.4.1.15
  • pillow 5.0.0
  • matplotlib 2.1.0
  • h5py 2.8.0
  • Kera 2.1.5

This is the stack trace:
File "/usr/local/lib/python3.6/site-packages/imageai/Detection/init.py", line 121, in loadModel
model = resnet50_retinanet(num_classes=80)
File "/usr/local/lib/python3.6/site-packages/imageai/Detection/keras_retinanet/models/resnet.py", line 86, in resnet50_retinanet
return resnet_retinanet(num_classes=num_classes, backbone='resnet50', inputs=inputs, **kwargs)
File "/usr/local/lib/python3.6/site-packages/imageai/Detection/keras_retinanet/models/resnet.py", line 69, in resnet_retinanet
resnet = keras_resnet.models.ResNet50(inputs, include_top=False, freeze_bn=True)
File "/usr/local/lib/python3.6/site-packages/imageai/Detection/keras_resnet/models/_2d.py", line 190, in ResNet50
return ResNet(inputs, blocks, numerical_names=numerical_names, block=keras_resnet.blocks.bottleneck_2d, include_top=include_top, classes=classes, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/imageai/Detection/keras_resnet/models/_2d.py", line 68, in ResNet
x = keras_resnet.layers.BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name="bn_conv1")(x)
File "/usr/local/lib/python3.6/site-packages/keras/engine/topology.py", line 619, in call
output = self.call(inputs, **kwargs)
File "/usr/local/lib/python3.6/site-packages/imageai/Detection/keras_resnet/layers/_batch_normalization.py", line 17, in call
return super(BatchNormalization, self).call(training=(not self.freeze), *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/keras/layers/normalization.py", line 176, in call
return normalize_inference()
File "/usr/local/lib/python3.6/site-packages/keras/layers/normalization.py", line 172, in normalize_inference
epsilon=self.epsilon)
File "/usr/local/lib/python3.6/site-packages/keras/backend/theano_backend.py", line 731, in batch_normalization
x, gamma, beta, mean, var, reduction_axes, epsilon)
File "/usr/local/lib/python3.6/site-packages/theano/tensor/nnet/bn.py", line 342, in batch_normalization_test
raise ValueError("epsilon must be at least 1e-5, got %s" % str(epsilon))
ValueError: epsilon must be at least 1e-5, got 1e-05

Thanks for your help in advance!

ValueError: you are trying to load a weight file containing 00 layers into a model with 147 layers.

Hello!
First, thank you for your great job

i'm trying to run the object_detection.py on Ubuntu 14.04 ( virtual box ) but getting an error
The libraries and their versions are up to date:

  • python 3.4.3
  • tensorflow 1.9.0
  • numpy 1.14.5
  • scipy 1.1.0
  • opencv_python 3.4.1.15
  • pillow 5.2.0
  • matplotlib 2.2.2
  • h5py 2.8.0
  • keras 2.2.0

Using TensorFlow backend.
2018-07-16 15:12:06.173943: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Traceback (most recent call last):
File "./object_detection.py", line 10, in
detector.loadModel()
File "/root/ImageAI/imageai/Detection/init.py", line 190, in loadModel
model.load_weights(self.modelPath)
File "/usr/local/lib/python3.4/dist-packages/keras/engine/network.py", line 1180, in load_weights
f, self.layers, reshape=reshape)
File "/usr/local/lib/python3.4/dist-packages/keras/engine/saving.py", line 901, in load_weights_from_hdf5_group
str(len(filtered_layers)) + ' layers.')
ValueError: You are trying to load a weight file containing 24 layers into a model with 147 layers.

Thank you for reading through.

Custom Model Training

I noticed that in #15 it was highlighted that you need at minimum 2 classes of objects to be able to utilize this functionality.

That seems like an arbitrary requirement so I was wanting to understand if this is a technical limitation or if this is just an opinionated decision that has been made.

How to perform custom object detection using custom dataset?

Hi, thanks for developing such amazing library for object recognition. I'm new to this field but I learn something new everyday.
I've been doing some image prediction using custom model (such in https://github.com/OlafenwaMoses/ImageAI/blob/master/imageai/Prediction/CUSTOMTRAINING.md), which is working properly. Now I'm trying to use the same model for object detection.
This is my code :

from imageai.Detection import ObjectDetection
import os
execution_path = os.getcwd()
detection = ObjectDetection()
detection.setModelTypeAsRetinaNet()
detection.setModelPath(os.path.join(execution_path, "model_ex-063_acc-0.733333.h5"))
detection.loadModel()
# blablabla

However I stumbled upon an error :

ValueError                                Traceback (most recent call last)
<ipython-input-7-5e894296657a> in <module>()
      1 detection.setModelPath(os.path.join(execution_path, "model_ex-063_acc-0.733333.h5"))
----> 2 detection.loadModel()

~\Anaconda3\lib\site-packages\imageai\Detection\__init__.py in loadModel(self, detection_speed)
    120             elif(self.__modelType == "retinanet"):
    121                 model = resnet50_retinanet(num_classes=80)
--> 122                 model.load_weights(self.modelPath)
    123                 self.__model_collection.append(model)
    124                 self.__modelLoaded = True

~\Anaconda3\lib\site-packages\keras\engine\network.py in load_weights(self, filepath, by_name, skip_mismatch, reshape)
   1178             else:
   1179                 saving.load_weights_from_hdf5_group(
-> 1180                     f, self.layers, reshape=reshape)
   1181 
   1182     def _updated_config(self):

~\Anaconda3\lib\site-packages\keras\engine\saving.py in load_weights_from_hdf5_group(f, layers, reshape)
    899                          'containing ' + str(len(layer_names)) +
    900                          ' layers into a model with ' +
--> 901                          str(len(filtered_layers)) + ' layers.')
    902 
    903     # We batch weight value assignments in a single backend call

ValueError: You are trying to load a weight file containing 107 layers into a model with 116 layers.

Not sure if we have this feature, I just trying my luck. Let me know if it hasn't yet implemented, it's a bug, or is it error from my side?

T.Hanks

output bounding boxes

thank you for your work and share, would it be possible to output the bounding box values of an arbitrary image? Sincerely thank you for your help!!

Close up Objects in Context not detected

I tried running some tests
Here is what i found I am not sure whether this is an issue to be report or not but nevertheless I am reporting it assuming this might help you

The below code was used

`from imageai.Detection import ObjectDetection
import os

execution_path = os.getcwd()

detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath( os.path.join(execution_path , "resnet50_coco_best_v2.0.1.h5"))
detector.loadModel()
custom_objects = detector.CustomObjects(person=True, car=True)
detections = detector.detectCustomObjectsFromImage(input_image=os.path.join(execution_path , "img1.png"),
output_image_path=os.path.join(execution_path , "image1_new.png"),
custom_objects=custom_objects, minimum_percentage_probability=65)

for eachObject in detections:
print(eachObject["name"] + " : " + eachObject["percentage_probability"] )
print("--------------------------------")`

The output was not as expected. This may be problem with resnet also.

img1
image1_new

object detection in satellite imagery

I tried to ingest 1 m satellite imagery for object identification in model. Model is unable to detect any object in this. I guess improved imageAI may support satellite imagery and video analysis ?

Issue with ImageAI : Custom Prediction Model Training

Hello.

I'm training to do a prediction for a custom dataset of leaves.

Firstly, before training, I see something like:
input_2 (InputLayer) (None, **224, 224,** 3) 0
Does this mean the dataset is supposed to be resized to (244,244)

Currently, it's just one type of leaf, so i set num_objects=1:
model_trainer.trainModel(num_objects=1, num_experiments=100, enhance_data=True, batch_size=32, show_network_summary=True)

Right now, it produces a value error:

ValueError: You are passing a target array of shape (32, 1) while using as loss categorical_crossentropy. categorical_crossentropy` expects targets to be binary matrices (1s and 0s) of shape (samples, classes). If your targets are integer classes, you can convert them to the expected format via:

from keras.utils import to_categorical
y_binary = to_categorical(y_int)

Alternatively, you can use the loss function sparse_categorical_crossentropy instead, which does expect integer targets.
`

Any ideas on how to rectify this? ________________________________________________________________________________________________

Undefined name 'args' in resnet.py

flake8 testing of https://github.com/OlafenwaMoses/ImageAI on Python 3.6.3

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./imageai/Detection/keras_resnet/blocks/_time_distributed_2d.py:66:187: F821 undefined name 'ryx'
        y = keras.layers.TimeDistributed(keras.layers.Conv2D(filters, kernel_size, strides=stride, use_bias=False, **parameters), name="res{}{}_branch2a".format(stage_char, block_char))(ryx)
                                                                                                                                                                                          ^
./imageai/Detection/keras_retinanet/models/resnet.py:99:53: F821 undefined name 'args'
    return resnet50_retinanet(num_classes, inputs, *args, **kwargs)
                                                    ^
./imageai/Detection/keras_retinanet/models/resnet.py:104:54: F821 undefined name 'args'
    return resnet101_retinanet(num_classes, inputs, *args, **kwargs)
                                                     ^
./imageai/Detection/keras_retinanet/models/resnet.py:109:54: F821 undefined name 'args'
    return resnet152_retinanet(num_classes, inputs, *args, **kwargs)
                                                     ^
4     F821 undefined name 'ryx'
4

No Module named 'tensorflow.python.keras'

I am getting an error "ModuleNotFoundError: No module named 'tensorflow.python.keras'".

Traceback (most recent call last):
File "FirstPrediction.py", line 7, in
from imageai.Prediction import ImagePrediction
File "C:\Users\joshir\Downloads\WinPython-64bit-3.6.3.0Qt5\python-3.6.3.amd64
lib\site-packages\imageai\Prediction_init_.py", line 2, in
from tensorflow.python.keras.preprocessing import image
ModuleNotFoundError: No module named 'tensorflow.python.keras'

Am I missing anything, I followed instruction and install required packages.

Thanks
RJ

Does it support Realtime object detection?

Hi, I am wondering if ImageAI currently supports realtime object detection with a live rtsp stream?

The current sample source codes show that it takes in a sample mp4 video file and later output another video file with objects detected.

I am using Kivy Video widget to display an RTSP live stream, and am wondering if could implement ImageAI so that we can see the objects being detected and tracked in real time.

Please advice.

ValueError: You are passing a target array of shape (32, 1) while using as loss `categorical_crossentropy`. `categorical_crossentropy` expects targets to be binary matrices (1s and 0s) of shape (samples, classes). If your targets are integer classes, you can convert them to the expected format via: ``` from keras.utils import to_categorical y_binary = to_categorical(y_int) ```

Dear author:
I am training model, but error
Code:
from imageai.Prediction.Custom import ModelTraining
model_trainer = ModelTraining()
model_trainer.setModelTypeAsResNet()
model_trainer.setDataDirectory("/media/bdre/cloud/pets")
model_trainer.trainModel(num_objects=1, num_experiments=100, enhance_data=True, batch_size=32,
show_network_summary=True)
Error:
Traceback (most recent call last):
File "/home/bdre/pyPorject/com/bdre/safehat/train_molde.py", line 6, in
model_trainer.trainModel(num_objects=1, num_experiments=100, enhance_data=True, batch_size=32, show_network_summary=True)
File "/home/bdre/.local/lib/python3.6/site-packages/imageai/Prediction/Custom/init.py", line 249, in trainModel
validation_steps=int(num_test / batch_size), callbacks=[checkpoint, lr_scheduler])
File "/home/bdre/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 1761, in fit_generator
initial_epoch=initial_epoch)
File "/home/bdre/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_generator.py", line 190, in fit_generator
x, y, sample_weight=sample_weight, class_weight=class_weight)
File "/home/bdre/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 1525, in train_on_batch
x, y, sample_weight=sample_weight, class_weight=class_weight)
File "/home/bdre/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py", line 925, in _standardize_user_data
y, self._feed_loss_fns, feed_output_shapes)
File "/home/bdre/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_utils.py", line 322, in check_loss_and_target_compatibility
y.shape) + ' while using as loss categorical_crossentropy. '
ValueError: You are passing a target array of shape (32, 1) while using as loss categorical_crossentropy. categorical_crossentropy expects targets to be binary matrices (1s and 0s) of shape (samples, classes). If your targets are integer classes, you can convert them to the expected format via:

from keras.utils import to_categorical
y_binary = to_categorical(y_int)

Alternatively, you can use the loss function sparse_categorical_crossentropy instead, which does expect integer targets.

Please help me.

ObjectDetection exception: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

C:\Users\admin\Anaconda3\python.exe D:/tensorflow/pyimages/detect.py
C:\Users\admin\Anaconda3\lib\site-packages\h5py_init_.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as register_converters
Using TensorFlow backend.
Traceback (most recent call last):
File "D:/tensorflow/pyimages/day2-object-detect/detect.py", line 9, in
detector.loadModel(detection_speed="fast")
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection_init
.py", line 121, in loadModel
model = resnet50_retinanet(num_classes=80)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\resnet.py", line 86, in resnet50_retinanet
return resnet_retinanet(num_classes=num_classes, backbone='resnet50', inputs=inputs, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\resnet.py", line 80, in resnet_retinanet
model = retinanet.retinanet_bbox(inputs=inputs, num_classes=num_classes, backbone=resnet, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 347, in retinanet_bbox
model = retinanet(inputs=inputs, num_classes=num_classes, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 302, in retinanet
submodels = default_submodels(num_classes, anchor_parameters)
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 210, in default_submodels
('regression', default_regression_model(anchor_parameters.num_anchors())),
File "C:\Users\admin\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 125, in default_regression_model
outputs = keras.layers.Reshape((-1, 4), name='pyramid_regression_reshape')(outputs)
File "C:\Users\admin\Anaconda3\lib\site-packages\keras\engine\topology.py", line 602, in call
output = self.call(inputs, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\keras\layers\core.py", line 391, in call
target_shape = self.compute_output_shape(input_shape)[1:]
File "C:\Users\admin\Anaconda3\lib\site-packages\keras\layers\core.py", line 376, in compute_output_shape
input_shape[1:], self.target_shape)
File "C:\Users\admin\Anaconda3\lib\site-packages\keras\layers\core.py", line 364, in _fix_unknown_dimension
original = np.prod(input_shape, dtype=int)
File "C:\Users\admin\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 2566, in prod
out=out, **kwargs)
File "C:\Users\admin\Anaconda3\lib\site-packages\numpy\core_methods.py", line 35, in _prod
return umr_prod(a, axis, dtype, out, keepdims)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

I copy the ObjectDetection demo codes and run, but it throws this exception.

detector.detectCustomObjectsFromImages returns negative numbers in box_points detection

Hi,

I'm trying to use ImageAI to preprocess a dataset. I basically want to detect persons inside the images and crop the image to only show the person.

I get negative numbers on the box_points in certain images. and although the bounding box appears in the image, the cropped image is only 1pixel wide.

Code I use:
detections, objects_path = detector.detectCustomObjectsFromImage(custom_objects=custom_objects, input_image=image_path, output_image_path=os.path.join(temp_path, 'detected' + id + '.jpg'), minimum_percentage_probability=50, extract_detected_objects=True)

Input image:
549-original

Image with drawn bounding box:
detected549

Detected person image (it can barely be seen because it is 1px wide):
person-1

The detections dict:
{'name': 'person', 'percentage_probability': 99.53956007957458, 'box_points': array([150, -4, 423, 397])}

How is the -4 value supposed to be interpreted? And how is it that the overlay bounding box is correct, but the saved image is not?

Please help! Thank you!

No object tracking functionality!

You said you provide the Video Custom Object Detection (Object Tracking) function, but after checking the code, I could not find any code related to object tracking. Am I wrong?

Passing array of images to detector

I want to pass an image array to detector not image path, How can I do that?
image_arr = cv2.imread(image_path)
detections = detector.detectObjectsFromImage(input_image=image_arr, extract_detected_objects=False,minimum_percentage_probability = 30)

Custom Model Training Tutorial not training

Hi. I created a dataset folder just as you described. I have one class, "vehicles," and so I have the train -> vehicle -> images and test -> vehicle -> images setup.

When I run

from imageai.Prediction.Custom import ModelTraining
model_trainer = ModelTraining()
model_trainer.setModelTypeAsResNet()
model_trainer.setDataDirectory("vehicles")
model_trainer.trainModel(num_objects=1, num_experiments=100, enhance_data=True, batch_size=32, show_network_summary=True)

I get the following error after Epoch 1 begins

Epoch 1/100
Traceback (most recent call last):
File "trainer.py", line 14, in
model_trainer.trainModel(num_objects=1, num_experiments=100, enhance_data=False, batch_size=32, show_network_summary=False)
File "C:\Users\RDITLDTS\anaconda3\lib\site-packages\imageai\Prediction\Custom_init_.py", line 240, in trainModel
validation_steps=int(num_test / batch_size), callbacks=[checkpoint, lr_scheduler])
File "C:\Users\RDITLDTS\anaconda3\lib\site-packages\tensorflow\python\keras_impl\keras\engine\training.py", line 2172, in fit_generator
x, y, sample_weight=sample_weight, class_weight=class_weight)
File "C:\Users\RDITLDTS\anaconda3\lib\site-packages\tensorflow\python\keras_impl\keras\engine\training.py", line 1855, in train_on_batch
check_batch_axis=True)
File "C:\Users\RDITLDTS\anaconda3\lib\site-packages\tensorflow\python\keras_impl\keras\engine\training.py", line 1449, in _standardize_user_data
self._feed_output_shapes)
File "C:\Users\RDITLDTS\anaconda3\lib\site-packages\tensorflow\python\keras_impl\keras\engine\training.py", line 283, in _check_loss_and_target_compatibility
y.shape) + ' while using as loss categorical_crossentropy. '
ValueError: You are passing a target array of shape (32, 1) while using as loss categorical_crossentropy. categorical_crossentropy expects targets to be binary matrices (1s and 0s) of shape (samples, classes). If your targets are integer classes, you can convert them to the expected format via:

from keras.utils import to_categorical
y_binary = to_categorical(y_int)

Alternatively, you can use the loss function sparse_categorical_crossentropy instead, which does expect integer targets.:

How do I fix this?

How to do fine-tuning with ImageAI?

Hi,

Thank you for the great work!

I would like to modify the model resnet50_coco_best_v2.1.0.h5 to modify the weights by adding a sample of data. This sample is not very large.
I would like to refine the object detection on a photo or video, especially looking for cars.

I read the readme and the examples but I did not find a solution to my problem. It's been a while now that I search on the internet but without success.

Could someone inform me?

thank you in advance

TypeError: must be str, not numpy.float64

Your example tutorial has this line:
print(eachObject["name"] + " : " + eachObject["percentage_probability"] )

But for me it throws TypeError exception, how do you make it to work? :) Maybe I forgot something I'm not sure. I use python 3.6.6

I have to use str() function:
print(eachObject["name"] + " : " + str(eachObject["percentage_probability"]) )

Object Detection Box Colors

Hello,

Where can I find the documentation for the colors used to label the objets in the detection mode?

Thanks
A

how i can specify GPU number ?

when i use

detector = ObjectDetection()
detector.setModelTypeAsRetinaNet()
detector.setModelPath(execution_path + 'resnet50_coco_best_v2.0.1.h5')
detector.loadModel()

detections = detector.detectObjectsFromImage(input_image=input_img, minimum_percentage_probability=70)

TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

I have encountered this problem.
Python 3.5.4 |Anaconda custom (64-bit)| (default, Aug 14 2017, 13:41:13) [MSC v.1900 64 bit (AMD64)] on win32

Traceback (most recent call last):
File "e:\ImageAI-master\examples\object_detection.py", line 13, in
detector.loadModel()
File "C:\ProgramData\Anaconda3\lib\site-packages\imageai\Detection_init_.py", line 121, in loadModel
model = resnet50_retinanet(num_classes=80)
File "C:\ProgramData\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\resnet.py", line 86, in resnet50_retinanet
return resnet_retinanet(num_classes=num_classes, backbone='resnet50', inputs=inputs, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\resnet.py", line 80, in resnet_retinanet
model = retinanet.retinanet_bbox(inputs=inputs, num_classes=num_classes, backbone=resnet, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 347, in retinanet_bbox
model = retinanet(inputs=inputs, num_classes=num_classes, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 302, in retinanet
submodels = default_submodels(num_classes, anchor_parameters)
File "C:\ProgramData\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 210, in default_submodels
('regression', default_regression_model(anchor_parameters.num_anchors())),
File "C:\ProgramData\Anaconda3\lib\site-packages\imageai\Detection\keras_retinanet\models\retinanet.py", line 125, in default_regression_model
outputs = keras.layers.Reshape((-1, 4), name='pyramid_regression_reshape')(outputs)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\topology.py", line 602, in call
output = self.call(inputs, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\core.py", line 391, in call
target_shape = self.compute_output_shape(input_shape)[1:]
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\core.py", line 376, in compute_output_shape
input_shape[1:], self.target_shape)
File "C:\ProgramData\Anaconda3\lib\site-packages\keras\layers\core.py", line 364, in _fix_unknown_dimension
original = np.prod(input_shape, dtype=int)
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 2518, in prod
out=out, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core_methods.py", line 35, in _prod
return umr_prod(a, axis, dtype, out, keepdims)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

master/examples/custom_object_detection.py

When trying to process image with possible stop sign in it this error occurs, I think there is issue with detectCustomObjectsFromImage functions object name "stop sign", I think error occurs, because object name consists of two words.

Traceback (most recent call last):
  File "C:\Program Files\Python35\lib\site-packages\imageai\Detection\__init__.py", line 430, in detectCustomObjectsFromImage
    if (custom_objects[check_name] == "invalid"):
KeyError: 'stop sign'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\justa\Desktop\ObjectDetection project\detect.py", line 16, in <module>
    detections = detector.detectCustomObjectsFromImage(custom_objects=custom_objects, input_image=os.path.join(execution_path , "image3.jpg"), output_image_path=os.path.join(execution_path , "image3custom.jpg"))
  File "C:\Program Files\Python35\lib\site-packages\imageai\Detection\__init__.py", line 480, in detectCustomObjectsFromImage
    "Ensure you specified correct input image, input type, output type and/or output image path ")
ValueError: Ensure you specified correct input image, input type, output type and/or output image path

ImageAI for Python2.7

ImageAI is a wonderful and convenient tool for object detection.
But when I tried to install it on my python2.7 platform, I met some problems.
Is there a release of ImageAI for Python2.7?
Thanks to the contributors.

Illegal instruction: 4

Hi, please help me, I still try 3 days for resolving my issue...

i have a MacBook Pro.

if I start your script, I got a error:

`sh-3.2# python3 FirstVideoObjectDetection.py

Using TensorFlow backend.
Illegal instruction: 4`

Problem is the last line (Illegal instruction: 4). This comes from this codeline:
video_path = detector.detectObjectsFromVideo(input_file_path=os.path.join(execution_path, "test.mp4"), output_file_path=os.path.join(execution_path, "traffic_detected"), frames_per_second=20, log_progress=True)

Have you a idea ???

Greets Christian

sh-3.2# pip3 freeze absl-py==0.2.2 astor==0.6.2 bleach==1.5.0 cloudpickle==0.5.3 cycler==0.10.0 dask==0.18.0 decorator==4.3.0 gast==0.2.0 grpcio==1.12.1 h5py==2.8.0 html5lib==0.9999999 imageai==2.0.1 imutils==0.4.6 Keras==2.2.0 Keras-Applications==1.0.2 Keras-Preprocessing==1.0.1 kiwisolver==1.0.1 Markdown==2.6.11 matplotlib==2.2.2 networkx==2.1 nose==1.3.7 numpy==1.13.0 opencv-python==3.4.1.15 pbr==4.0.4 Pillow==5.1.0 protobuf==3.6.0 psycopg2==2.7.5 PyAutoGUI==0.9.36 PyMsgBox==1.0.6 pyobjc==4.2.2 pyobjc-core==4.2.2 pyobjc-framework-Accounts==4.2.2 pyobjc-framework-AddressBook==4.2.2 pyobjc-framework-AppleScriptKit==4.2.2 pyobjc-framework-AppleScriptObjC==4.2.2 pyobjc-framework-ApplicationServices==4.2.2 pyobjc-framework-Automator==4.2.2 pyobjc-framework-AVFoundation==4.2.2 pyobjc-framework-AVKit==4.2.2 pyobjc-framework-BusinessChat==4.2.2 pyobjc-framework-CalendarStore==4.2.2 pyobjc-framework-CFNetwork==4.2.2 pyobjc-framework-CloudKit==4.2.2 pyobjc-framework-Cocoa==4.2.2 pyobjc-framework-Collaboration==4.2.2 pyobjc-framework-ColorSync==4.2.2 pyobjc-framework-Contacts==4.2.2 pyobjc-framework-ContactsUI==4.2.2 pyobjc-framework-CoreBluetooth==4.2.2 pyobjc-framework-CoreData==4.2.2 pyobjc-framework-CoreLocation==4.2.2 pyobjc-framework-CoreML==4.2.2 pyobjc-framework-CoreServices==4.2.2 pyobjc-framework-CoreSpotlight==4.2.2 pyobjc-framework-CoreText==4.2.2 pyobjc-framework-CoreWLAN==4.2.2 pyobjc-framework-CryptoTokenKit==4.2.2 pyobjc-framework-DictionaryServices==4.2.2 pyobjc-framework-DiskArbitration==4.2.2 pyobjc-framework-EventKit==4.2.2 pyobjc-framework-ExceptionHandling==4.2.2 pyobjc-framework-ExternalAccessory==4.2.2 pyobjc-framework-FinderSync==4.2.2 pyobjc-framework-FSEvents==4.2.2 pyobjc-framework-GameCenter==4.2.2 pyobjc-framework-GameController==4.2.2 pyobjc-framework-GameKit==4.2.2 pyobjc-framework-GameplayKit==4.2.2 pyobjc-framework-ImageCaptureCore==4.2.2 pyobjc-framework-IMServicePlugIn==4.2.2 pyobjc-framework-InputMethodKit==4.2.2 pyobjc-framework-InstallerPlugins==4.2.2 pyobjc-framework-InstantMessage==4.2.2 pyobjc-framework-Intents==4.2.2 pyobjc-framework-IOSurface==4.2.2 pyobjc-framework-iTunesLibrary==4.2.2 pyobjc-framework-LatentSemanticMapping==4.2.2 pyobjc-framework-LaunchServices==4.2.2 pyobjc-framework-libdispatch==4.2.2 pyobjc-framework-LocalAuthentication==4.2.2 pyobjc-framework-MapKit==4.2.2 pyobjc-framework-MediaAccessibility==4.2.2 pyobjc-framework-MediaLibrary==4.2.2 pyobjc-framework-MediaPlayer==4.2.2 pyobjc-framework-ModelIO==4.2.2 pyobjc-framework-MultipeerConnectivity==4.2.2 pyobjc-framework-NetFS==4.2.2 pyobjc-framework-NetworkExtension==4.2.2 pyobjc-framework-NotificationCenter==4.2.2 pyobjc-framework-OpenDirectory==4.2.2 pyobjc-framework-Photos==4.2.2 pyobjc-framework-PhotosUI==4.2.2 pyobjc-framework-PreferencePanes==4.2.2 pyobjc-framework-PubSub==4.2.2 pyobjc-framework-QTKit==4.2.2 pyobjc-framework-Quartz==4.2.2 pyobjc-framework-SafariServices==4.2.2 pyobjc-framework-SceneKit==4.2.2 pyobjc-framework-ScreenSaver==4.2.2 pyobjc-framework-ScriptingBridge==4.2.2 pyobjc-framework-SearchKit==4.2.2 pyobjc-framework-Security==4.2.2 pyobjc-framework-SecurityFoundation==4.2.2 pyobjc-framework-SecurityInterface==4.2.2 pyobjc-framework-ServiceManagement==4.2.2 pyobjc-framework-Social==4.2.2 pyobjc-framework-SpriteKit==4.2.2 pyobjc-framework-StoreKit==4.2.2 pyobjc-framework-SyncServices==4.2.2 pyobjc-framework-SystemConfiguration==4.2.2 pyobjc-framework-Vision==4.2.2 pyobjc-framework-WebKit==4.2.2 pyparsing==2.2.0 PyScreeze==0.1.14 pytesseract==0.2.2 python-dateutil==2.7.3 PyTweening==1.0.3 pytz==2018.4 PyWavelets==0.5.2 PyYAML==3.12 scikit-image==0.14.0 scikit-learn==0.19.1 scipy==1.1.0 six==1.11.0 sklearn==0.0 stevedore==1.28.0 tensorboard==1.8.0 tensorflow==1.5.0 tensorflow-tensorboard==1.5.1 termcolor==1.1.0 toolz==0.9.0 torch==0.4.0 torchvision==0.2.1 utils==0.9.0 virtualenv==16.0.0 virtualenv-clone==0.3.0 virtualenvwrapper==4.8.2 Werkzeug==0.14.1

Labels for training set.

Hello,
This library is gonna save my life. Just a clarification. While training for the custom dataset, is labeling the images with the bounding boxes in the training set needed? I don't know much about RetinaNet. Hence, just wanted to confirm. I did see in many other methods, bounding boxes and other kinds of segmentations were done on the image set.

Thanks in Advance

With Regards
Sanath Bharadwaj

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.