Giter VIP home page Giter VIP logo

deep-learning's Introduction

Deep-Learning

This repository contains deep learning related projects I have done over time. I am very passionate about deep learning and explore interesting ideas and tools. Each project is contained in its own folder.

I have blogged about a lot of these projects on Medium - https://medium.com/@priya.dwivedi

I also run a deep learning consultancy - https://deeplearninganalytics.org/

If you want to collaborate on a project please reach out through my website.

Hope you enjoy cloning this repo and trying out things yourself

deep-learning's People

Contributors

priya-dwivedi 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  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

deep-learning's Issues

error in Importing resnet

Hi everyone, am getting error while importing resnet. I installed resnet but still getting this error. can some one help?

ModuleNotFoundError Traceback (most recent call last)
in ()
12 from keras.utils.vis_utils import model_to_dot
13 from keras.utils import plot_model
---> 14 from resnets_utils import *
15 from keras.initializers import glorot_uniform
16 import scipy.misc

ModuleNotFoundError: No module named 'resnets_utils'


index 544 is out of bounds for axis 1 with size 50

Dear Dr Priya,
I am trying to execute the handwriten-recognition module.

Unfortunately, I am having an error when I try execute the train step. The error is: index 544 is out of bounds for axis 1 with size 50.

I tried on Windows and Unbutu and the error it occurred in both.

Can you help me please?

untitled-1

How to use create_pet_tf_record.py file?

Is is told inside the file that
./create_pet_tf_record --data_dir=/home/user/pet --output_dir=/home/user/pet/output
will lead us to create a tf record file .. just tell me how me how system will know where is the annotation .. and where is images file ..
just guide me how you are using this statement .. can u share your own code snippet of how u execute this file..

Training on GPU

I tried training the model with both CPU and GPU. It works fine on CPU but takes very long. But when I install GPU version and run it, it gets stuck in the middle. It doesn't throw any error but it just stops at a point before showing verbose. Could you help me figure out what is possibly going wrong? @priya-dwivedi

result is disappointed !!

Hi
Thanks for sharing your efforts,

I trained my own dataset (which is 30 images) I reached more than 30K training steps. But I got very bad results, I guess the config file need to be modified, such as reducing the threshold number!!.

Do have suggestions to improve it, could you please share your config file.

Thanks

train.py Code is out of date

Tensorflow is moving too fast, so one of the imports in train.py is out of date. The trainer library is now in the legacy folder. For anyone that runs into this problem using the latest code and tensorflow 1.x.

from object_detection.legacy import trainer

Problem with tensorboard

I did the training and in the end I generated the file metadata.tsv, however, when opening the tensorboard the following error occurs: "ckeckpoints / metadata.tsv is not a file" (follows printscreen). What should I do to use the tensorboard view? I use linux.
tensorboard

My process being killed the moment it start training

I am trying to train image detector using my own dataset but it fails. I've made few changes in configuration file apart from number of classes and paths. Here are they

train_input_reader: {
  tf_record_input_reader {
    input_path: "data/data_train.record"
  }
  label_map_path: "data/rdata_train.pbtxt"
  queue_capacity: 2
  min_after_dequeue: 1
}
train_config: {
  batch_size: 1
  optimizer {
    rms_prop_optimizer: {
      learning_rate: {
        exponential_decay_learning_rate {
          initial_learning_rate: 0.1
          decay_steps: 800720
          decay_factor: 0.95
        }
      }
      momentum_optimizer_value: 0.9
      decay: 0.9
      epsilon: 0.000001
    }
  }
  fine_tune_checkpoint: "ssd_mobilenet_v1_coco_2017_11_17/model.ckpt"
  from_detection_checkpoint: true
  # Note: The below line limits the training process to 200K steps, which we
  # empirically found to be sufficient enough to train the pets dataset. This
  # effectively bypasses the learning rate schedule (the learning rate will
  # never decay). Remove the below line to train indefinitely.
  num_steps: 200000
  batch_queue_capacity: 5
  num_batch_queue_threads: 8
  prefetch_queue_capacity: 5
}

But it fails to start training. I checked issues on tensorflow research repository but no specific answer I was able to find.

/home/ubuntu/.conda/envs/tf/lib/python3.6/site-packages/h5py/__init__.py:36: 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
WARNING:tensorflow:From /dev/models/research/object_detection/trainer.py:228: create_global_step (from tensorflow.contrib.framework.python.ops.variables) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.create_global_step
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:Summary name /clone_loss is illegal; using clone_loss instead.
WARNING:tensorflow:From /home/ubuntu/.conda/envs/tf/lib/python3.6/site-packages/tensorflow/contrib/slim/python/slim/learning.py:736: Supervisor.__init__ (from tensorflow.python.training.supervisor) is deprecated and will be removed in a future version.
Instructions for updating:
Please switch to tf.train.MonitoredTrainingSession
2018-03-22 14:14:27.789420: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2018-03-22 14:14:27.925567: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:898] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-03-22 14:14:27.925895: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1212] Found device 0 with properties: 
name: Tesla K80 major: 3 minor: 7 memoryClockRate(GHz): 0.8235
pciBusID: 0000:00:1e.0
totalMemory: 11.17GiB freeMemory: 11.10GiB
2018-03-22 14:14:27.925920: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1312] Adding visible gpu devices: 0
2018-03-22 14:14:29.848609: I tensorflow/core/common_runtime/gpu/gpu_device.cc:993] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10764 MB memory) -> physical GPU (device: 0, name: Tesla K80, pci bus id: 0000:00:1e.0, compute capability: 3.7)
INFO:tensorflow:Restoring parameters from ckpts/model.ckpt-0
INFO:tensorflow:Running local_init_op.
INFO:tensorflow:Done running local_init_op.
INFO:tensorflow:Starting Session.
INFO:tensorflow:Saving checkpoint to path ckpts/model.ckpt
INFO:tensorflow:Starting Queues.
INFO:tensorflow:global_step/sec: 0
INFO:tensorflow:Recording summary at step 0.
Killed

Please help

Many thanks!!!

Python syntax error in ./Kaggle Fisheries/hyperas_optimization.py

Also missing numpy import in ./word2vec_skipgram/utils.py.

flake8 testing of https://github.com/priya-dwivedi/Deep-Learning on Python 3.7.0

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

./word2vec_skipgram/utils.py:39:13: F821 undefined name 'np'
    xdata = np.array(int_text[: n_batches * batch_size * seq_length])
            ^
./word2vec_skipgram/utils.py:40:13: F821 undefined name 'np'
    ydata = np.array(int_text[1: n_batches * batch_size * seq_length + 1])
            ^
./word2vec_skipgram/utils.py:42:17: F821 undefined name 'np'
    x_batches = np.split(xdata.reshape(batch_size, -1), n_batches, 1)
                ^
./word2vec_skipgram/utils.py:43:17: F821 undefined name 'np'
    y_batches = np.split(ydata.reshape(batch_size, -1), n_batches, 1)
                ^
./Kaggle Fisheries/hyperas_optimization.py:179:24: E999 SyntaxError: invalid syntax
              verbos======e=2,
                       ^
1     E999 SyntaxError: invalid syntax
4     F821 undefined name 'np'
5

No module named 'object_detection'

When I creating the TFR datasets with create_pet_tf_record.py
Error:
Traceback (most recent call last):
File "C:\Users\NguyenThiTam\Desktop\object_demo\create_pet_tf_record.py", line 39, in
from object_detection.utils import dataset_util
ImportError: No module named 'object_detection'
I try run: python setup.py install with cmd as admin
Error:
python: can't open file 'setup.py': [Errno 2] No such file or directory

I using Window 8.1
Can you help me??? Thank you.

Use Grayscale Images Instead of RGB

Priya,

Excellent work.
How could I feed grayscale images instead of using RGB? My cameras do not produce RBG images, so I shall not train with RGB images. I thought maybe you have a tip on how to change the neural network to use one channel images instead.

cannot find mask_rcnn_damage_0010.h5

Hi,

when i run the file inspect_custom_weight and inspect_custom_model. I get the following error.

OSError Traceback (most recent call last)
in ()
8 # Load weights
9 print("Loading weights ", weights_path)
---> 10 model.load_weights(weights_path, by_name=True)

OSError: Unable to open file (unable to open file: name = 'mask_rcnn_damage_0010.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)

It seems., it is not able to load the model.
Can you help me out with this.
Thanks

Mask-RCNN: Multiple false detections for 'toy' dataset

Hi,
When I train the model with the 'toy' data-set and evaluate the performance of the trained model on test images using mask_rcnn_custom_images.ipynb, I get the following results.

image
image
image

Clearly, there are multiple false detections contrary to what is expected. I would appreciate if anyone could point out where I maybe going wrong and suggest possible way-outs.

Thanks.

trainval.txt not found

Hi, I not found trainval.txt file in tensorflow_toy_detector, but it required for create_pet_tf_record.py

$ python create_pet_tf_record.py --label_map_path=toy_label_map.pbtxt --data_dir=`pwd` --output_dir=`pwd`

Traceback (most recent call last):
  File "create_pet_tf_record.py", line 213, in <module>
    tf.app.run()
  File "project/.tensorflow/local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "create_pet_tf_record.py", line 192, in main
    examples_list = dataset_util.read_examples_list(examples_path)
  File "project/models/research/object_detection/utils/dataset_util.py", line 59, in read_examples_list
    lines = fid.readlines()
  File "project/.tensorflow/local/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 181, in readlines
    self._preread_check()
  File "project/.tensorflow/local/lib/python2.7/site-packages/tensorflow/python/lib/io/file_io.py", line 78, in _preread_check
    compat.as_bytes(self.__name), 1024 * 512, status)
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "project/.tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.NotFoundError: project/Deep-Learning/tensorflow_toy_detector/annotations/trainval.txt

mask is not displayed

hin thanks for your great link.

i don'tunderstant all is configured but i dont see the mask on eval or detection object. i made exactly as you but from several days i have this issue

KeyError: 'regions'

hi every body
i replace train and val folder with my train and val folder then i ran the inspect_custom_data.ipynb but i faced this error
KeyError Traceback (most recent call last)
in ()
3 # https://github.com/matterport/Mask_RCNN/releases
4 dataset = custom.CustomDataset()
----> 5 dataset.load_custom(CUSTOM_DIR, "train")
6
7 # Must call before using the dataset

~/Deep-Learning/mask_rcnn_damage_detection/custom.py in load_custom(self, dataset_dir, subset)
118 # The VIA tool saves images in the JSON even if they don't have any
119 # annotations. Skip unannotated images.
--> 120 annotations = [a for a in annotations if a['regions']]
121
122 # Add images

~/Deep-Learning/mask_rcnn_damage_detection/custom.py in (.0)
118 # The VIA tool saves images in the JSON even if they don't have any
119 # annotations. Skip unannotated images.
--> 120 annotations = [a for a in annotations if a['regions']]
121
122 # Add images

KeyError: 'regions'
can every body help me

[Custom_Mask_RCNN] Labeling masks correctly

Thanks for your great work.

I am trying to label my images as you suggest with PixelAnnotationTool and I wonder what ID to use for the object I want to segment.

According to lines 121 and 122 in create_pet_tf_record.py:

nonbackground_indices_x = np.any(mask_np != 2, axis=0)
nonbackground_indices_y = np.any(mask_np != 2, axis=1)

I understand background instance must have pixel value 2 and any other pixel value will represent a different label, i.e.: 0 for car, 1 for toy, 3 for apple, etc.

I would like to know if my assumption is correct and whether this has been the way you have proceeded.

Thanks again.

Saving trained weights

After training the model, code does not have any block to save the trained weights. Do I need to add my own block for that or I am missing out on anything? If yes, could you guide me on where to add those lines? @priya-dwivedi

TypeError: x and y must have the same dtype, got tf.float32 != tf.int32

i am learning the tensorflow object detection api.i can train model normally using the train.py script,but when i use the eval.py script to evaluate it,some wrong happend.
python eval.py --logtostderr \

--checkpoint_dir=train_log
--eval_dir=eval_log
--pipeline_config_path=ssd_mobilenet_v1_coco.config
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
Traceback (most recent call last):
File "eval.py", line 168, in
tf.app.run()
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "eval.py", line 164, in main
FLAGS.checkpoint_dir, FLAGS.eval_dir)
File "/home/yj/tensorflow3/models/research/object_detection/evaluator.py", line 142, in evaluate
ignore_groundtruth=eval_config.ignore_groundtruth)
File "/home/yj/tensorflow3/models/research/object_detection/evaluator.py", line 61, in _extract_prediction_tensors
detections = model.postprocess(prediction_dict)
File "/home/yj/tensorflow3/models/research/object_detection/meta_architectures/ssd_meta_arch.py", line 405, in postprocess
class_predictions_without_background)
File "/home/yj/tensorflow3/models/research/object_detection/builders/post_processing_builder.py", line 94, in score_converter_fn
scaled_logits = tf.divide(logits, logit_scale, name='scale_logits')
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/math_ops.py", line 309, in divide
return DivideDelegateWithName(x, name) / y
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/math_ops.py", line 294, in truediv
return _truediv_python3(self.x, y, self.name)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/ops/math_ops.py", line 981, in _truediv_python3
(x_dtype, y_dtype))
TypeError: x and y must have the same dtype, got tf.float32 != tf.int32

my tf version is 1.4.0,python3.4,cpu,thanks

Video upload

Hi, can you upload your videos to github in order to execute the full example?

Thanks.

Error running: %time white_clip.write_videofile (white_output1, audio = False) in Object_Detection_Tensorflow_API.ipynb

Hi,
I am quite new in this topic and I have tried to execute the code of the following link:
https://github.com/priya-dwivedi/Deep-Learning/blob/master/Object_Detection_Tensorflow_API.ipynb

The detection of objects in the images does not give any problem. The error appears when executing the following line of code:
% time white_clip.write_videofile (white_output1, audio = False)

It is interrupted at 12%.

The error code is as follows:
Moviepy - Building video video1_out.mp4.
Moviepy - Writing video video1_out.mp4

t: 12%|█▏ | 6/50 [00:37<04:37, 6.30s/it, now=None]

ValueError Traceback (most recent call last)
in

<C:\Users\A\Anaconda3\envs\tfg\lib\site-packages\decorator.py:decorator-gen-176> in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, logger)

~\Anaconda3\envs\tfg\lib\site-packages\moviepy\decorators.py in requires_duration(f, clip, *a, **k)
52 raise ValueError("Attribute 'duration' not set")
53 else:
---> 54 return f(clip, *a, **k)
55
56

<C:\Users\A\Anaconda3\envs\tfg\lib\site-packages\decorator.py:decorator-gen-175> in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, logger)

~\Anaconda3\envs\tfg\lib\site-packages\moviepy\decorators.py in use_clip_fps_by_default(f, clip, *a, **k)
135 for (k,v) in k.items()}
136
--> 137 return f(clip, *new_a, **new_kw)

<C:\Users\A\Anaconda3\envs\tfg\lib\site-packages\decorator.py:decorator-gen-174> in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, logger)

~\Anaconda3\envs\tfg\lib\site-packages\moviepy\decorators.py in convert_masks_to_RGB(f, clip, *a, **k)
20 if clip.ismask:
21 clip = clip.to_RGB()
---> 22 return f(clip, *a, **k)
23
24 @decorator.decorator

~\Anaconda3\envs\tfg\lib\site-packages\moviepy\video\VideoClip.py in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, logger)
324 verbose=verbose, threads=threads,
325 ffmpeg_params=ffmpeg_params,
--> 326 logger=logger)
327
328 if remove_temp and make_audio:

~\Anaconda3\envs\tfg\lib\site-packages\moviepy\video\io\ffmpeg_writer.py in ffmpeg_write_video(clip, filename, fps, codec, bitrate, preset, withmask, write_logfile, audiofile, verbose, threads, ffmpeg_params, logger)
214
215 for t,frame in clip.iter_frames(logger=logger, with_times=True,
--> 216 fps=fps, dtype="uint8"):
217 if withmask:
218 mask = (255*clip.mask.get_frame(t))

~\Anaconda3\envs\tfg\lib\site-packages\moviepy\Clip.py in iter_frames(self, fps, with_times, logger, dtype)
473 logger = proglog.default_bar_logger(logger)
474 for t in logger.iter_bar(t=np.arange(0, self.duration, 1.0/fps)):
--> 475 frame = self.get_frame(t)
476 if (dtype is not None) and (frame.dtype != dtype):
477 frame = frame.astype(dtype)

<C:\Users\A\Anaconda3\envs\tfg\lib\site-packages\decorator.py:decorator-gen-135> in get_frame(self, t)

~\Anaconda3\envs\tfg\lib\site-packages\moviepy\decorators.py in wrapper(f, *a, **kw)
87 new_kw = {k: fun(v) if k in varnames else v
88 for (k,v) in kw.items()}
---> 89 return f(*new_a, **new_kw)
90 return decorator.decorator(wrapper)
91

~\Anaconda3\envs\tfg\lib\site-packages\moviepy\Clip.py in get_frame(self, t)
93 return frame
94 else:
---> 95 return self.make_frame(t)
96
97 def fl(self, fun, apply_to=None, keep_duration=True):

~\Anaconda3\envs\tfg\lib\site-packages\moviepy\Clip.py in (t)
136
137 #mf = copy(self.make_frame)
--> 138 newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
139
140 if not keep_duration:

~\Anaconda3\envs\tfg\lib\site-packages\moviepy\video\VideoClip.py in (gf, t)
509 if apply_to is None:
510 apply_to = []
--> 511 return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
512
513 # --------------------------------------------------------------

in process_image(image)
4 with detection_graph.as_default():
5 with tf.Session(graph=detection_graph) as sess:
----> 6 image_process = detect_objects(image, sess, detection_graph)
7 return image_process

in detect_objects(image_np, sess, detection_graph)
26 category_index,
27 use_normalized_coordinates=True,
---> 28 line_thickness=8)
29 return image_np

~\Anaconda3\envs\tfg\Lib\site-packages\tensorflow\models\research\object_detection\utils\visualization_utils.py in visualize_boxes_and_labels_on_image_array(image, boxes, classes, scores, category_index, instance_masks, instance_boundaries, keypoints, use_normalized_coordinates, max_boxes_to_draw, min_score_thresh, agnostic_mode, line_thickness, groundtruth_box_visualization_color, skip_scores, skip_labels)
742 thickness=line_thickness,
743 display_str_list=box_to_display_str_map[box],
--> 744 use_normalized_coordinates=use_normalized_coordinates)
745 if keypoints is not None:
746 draw_keypoints_on_image_array(

~\Anaconda3\envs\tfg\Lib\site-packages\tensorflow\models\research\object_detection\utils\visualization_utils.py in draw_bounding_box_on_image_array(image, ymin, xmin, ymax, xmax, color, thickness, display_str_list, use_normalized_coordinates)
127 thickness, display_str_list,
128 use_normalized_coordinates)
--> 129 np.copyto(image, np.array(image_pil))
130
131

ValueError: assignment destination is read-only

Can you help me?

Mask Rcnn gives weird outputs

index2
I run the training for 8 hours on a GPU but i dont know why i get this output. I tried it with a different dataset and still the same.

mask_rcnn_damage and class "Person" : How to fine-tune Mask RCNN coco models on this existant coco class

Hello,
I am using your code (custom.py) on mask_rcnn_damage to train a coco model (mask_rcnn_coco.h5) on recognizing persons on new images. I used to annotate those images using the VGG annotator.

My question is the following : Knowing that the person class exists already in the COCO dataset. Should I keep this line of code in your custom.py script ?
# Add classes. We have only one class to add. self.add_class("person", 1, "person")

If I remove it, I get errors.
Thank you for your help

NoneType object has no attribute groups

Hi!
I have a problem with creating record files with your create_pet_tf_record.py version. When I call:
python object_detection/dataset_tools/create_pet_tf_record.py --label_map_path=object_detection/data/label.pbtxt --data_dir=pwd --output_dir=pwd``

it returns me this error:

File "object_detection/dataset_tools/create_pet_tf_record.py", line 204, in
tf.app.run()
File "/Users/user/tensorflow/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "object_detection/dataset_tools/create_pet_tf_record.py", line 199, in main
image_dir, train_examples)
File "object_detection/dataset_tools/create_pet_tf_record.py", line 168, in create_tf_record
tf_example = dict_to_tf_example(data, label_map_dict, image_dir)
File "object_detection/dataset_tools/create_pet_tf_record.py", line 112, in dict_to_tf_example
class_name = get_class_name_from_filename(data['filename'])
File "object_detection/dataset_tools/create_pet_tf_record.py", line 57, in get_class_name_from_filename
return match.groups()[0]
AttributeError: 'NoneType' object has no attribute 'groups'

Can anyone know the solution of this problem?

AttributeError: 'NoneType' object has no attribute 'groups'

python /home/gopalakrishna/tfrecords/create_tf.py
/home/gopalakrishna/anaconda2/lib/python2.7/site-packages/h5py/init.py:36: 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
/home/gopalakrishna/work/models/object_detection/utils/dataset_util.py:75: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead.
if not xml:
Traceback (most recent call last):
File "/home/gopalakrishna/tfrecords/create_tf.py", line 213, in
tf.app.run()
File "/home/gopalakrishna/.local/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "/home/gopalakrishna/tfrecords/create_tf.py", line 208, in main
image_dir, train_examples)
File "/home/gopalakrishna/tfrecords/create_tf.py", line 177, in create_tf_record
tf_example = dict_to_tf_example(data, label_map_dict, image_dir)
File "/home/gopalakrishna/tfrecords/create_tf.py", line 120, in dict_to_tf_example
class_name = get_class_name_from_filename(data['filename'])
File "/home/gopalakrishna/tfrecords/create_tf.py", line 61, in get_class_name_from_filename
return match.groups()[0]
AttributeError: 'NoneType' object has no attribute 'groups'

image2.jpg

Hi, i don't have any idea about image2.jpg file in soccer_realtime.ipynb.
Can you upload this file please?

Thank you.

i loaded a video if my choice bit it wont excute

ValueError Traceback (most recent call last)
in ()
6 white_output = new_loc
7 clip1 = VideoFileClip(filename).subclip(60,68)
----> 8 white_clip = clip1.fl_image(process_image) #NOTE: this function expects color images!!s
9 get_ipython().run_line_magic('time', 'white_clip.write_videofile(white_output, audio=False)')

c:\program files\python36\lib\site-packages\moviepy\video\VideoClip.py in fl_image(self, image_func, apply_to)
504 if apply_to is None:
505 apply_to = []
--> 506 return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
507
508 # --------------------------------------------------------------

c:\program files\python36\lib\site-packages\moviepy\Clip.py in fl(self, fun, apply_to, keep_duration)
135
136 #mf = copy(self.make_frame)
--> 137 newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
138
139 if not keep_duration:

in set_make_frame(self, mf)

c:\program files\python36\lib\site-packages\moviepy\decorators.py in outplace(f, clip, *a, **k)
12 """ Applies f(clip.copy(), *a, **k) and returns clip.copy()"""
13 newclip = clip.copy()
---> 14 f(newclip, *a, **k)
15 return newclip
16

c:\program files\python36\lib\site-packages\moviepy\video\VideoClip.py in set_make_frame(self, mf)
659 """
660 self.make_frame = mf
--> 661 self.size = self.get_frame(0).shape[:2][::-1]
662
663 @outplace

in get_frame(self, t)

c:\program files\python36\lib\site-packages\moviepy\decorators.py in wrapper(f, *a, **kw)
87 new_kw = {k: fun(v) if k in varnames else v
88 for (k,v) in kw.items()}
---> 89 return f(*new_a, **new_kw)
90 return decorator.decorator(wrapper)
91

c:\program files\python36\lib\site-packages\moviepy\Clip.py in get_frame(self, t)
92 return frame
93 else:
---> 94 return self.make_frame(t)
95
96 def fl(self, fun, apply_to=None, keep_duration=True):

c:\program files\python36\lib\site-packages\moviepy\Clip.py in (t)
135
136 #mf = copy(self.make_frame)
--> 137 newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
138
139 if not keep_duration:

c:\program files\python36\lib\site-packages\moviepy\video\VideoClip.py in (gf, t)
504 if apply_to is None:
505 apply_to = []
--> 506 return self.fl(lambda gf, t: image_func(gf(t)), apply_to)
507
508 # --------------------------------------------------------------

in process_image(image)
7 with detection_graph.as_default():
8 with tf.Session(graph=detection_graph) as sess:
----> 9 image_np = detect_videos(image, sess, detection_graph)
10
11 counter +=1

in detect_videos(image_np, sess, detection_graph)
51 instance_masks=output_dict.get('detection_masks'),
52 use_normalized_coordinates=True,
---> 53 line_thickness=1)
54
55 return image_np

C:\object_recognition_detection\utils\visualization_utils.py in visualize_boxes_and_labels_on_image_array(image, boxes, classes, scores, category_index, instance_masks, keypoints, use_normalized_coordinates, max_boxes_to_draw, min_score_thresh, agnostic_mode, line_thickness)
405 image,
406 box_to_instance_masks_map[box],
--> 407 color=color
408 )
409 draw_bounding_box_on_image_array(

C:\object_recognition_detection\utils\visualization_utils.py in draw_mask_on_image_array(image, mask, color, alpha)
307 raise ValueError('image not of type np.uint8')
308 if mask.dtype != np.float32:
--> 309 raise ValueError('mask not of type np.float32')
310 if np.any(np.logical_or(mask > 1.0, mask < 0.0)):
311 raise ValueError('mask elements should be in [0, 1]')

ValueError: mask not of type np.float32

Kernel dies!

Hello!

Big soccer fan here!
I made a copy of you repo in my colab but when I run this code my kernel dies, do you know what can be wrong?

detection_graph = tf.Graph()
with detection_graph.as_default():
od_graph_def = tf.GraphDef()
with tf.gfile.GFile(PATH_TO_CKPT, 'rb') as fid:
serialized_graph = fid.read()
od_graph_def.ParseFromString(serialized_graph)
tf.import_graph_def(od_graph_def, name='')

To View Color Mask

filename = 'image2.jpg'
image = cv2.imread(filename)
resize = cv2.resize(image, (640,360))
detect_team(resize, show=True)

hello,I have some questions about Mask_RCNN_Videos.ipynb .

How to install the environment to run Mask_RCNN_Videos.ipynb .?
I have the error about
InvalidArgumentError: NodeDef mentions attr 'identical_element_shapes' not in Op<name=TensorArrayV3; signature=size:int32 -> handle:resource, flow:float; attr=dtype:type; attr=element_shape:shape,default=; attr=dynamic_size:bool,default=false; attr=clear_after_read:bool,default=true; attr=tensor_array_name:string,default=""; is_stateful=true>; NodeDef: Preprocessor/map/TensorArray = TensorArrayV3clear_after_read=true, dtype=DT_FLOAT, dynamic_size=false, element_shape=, identical_element_shapes=true, tensor_array_name="", _device="/job:localhost/replica:0/task:0/device:CPU:0". (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
[[Node: Preprocessor/map/TensorArray = TensorArrayV3clear_after_read=true, dtype=DT_FLOAT, dynamic_size=false, element_shape=, identical_element_shapes=true, tensor_array_name="", _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

Caused by op 'Preprocessor/map/TensorArray', defined at:
File "D:\anaconda\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "D:\anaconda\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\anaconda\lib\site-packages\ipykernel_launcher.py", line 16, in
app.launch_new_instance()
File "D:\anaconda\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "D:\anaconda\lib\site-packages\ipykernel\kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "D:\anaconda\lib\site-packages\zmq\eventloop\ioloop.py", line 177, in start
super(ZMQIOLoop, self).start()
File "D:\anaconda\lib\site-packages\tornado\ioloop.py", line 888, in start
handler_func(fd_obj, events)
File "D:\anaconda\lib\site-packages\tornado\stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "D:\anaconda\lib\site-packages\zmq\eventloop\zmqstream.py", line 440, in _handle_events
self._handle_recv()
File "D:\anaconda\lib\site-packages\zmq\eventloop\zmqstream.py", line 472, in _handle_recv
self._run_callback(callback, msg)
File "D:\anaconda\lib\site-packages\zmq\eventloop\zmqstream.py", line 414, in _run_callback
callback(*args, **kwargs)
File "D:\anaconda\lib\site-packages\tornado\stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "D:\anaconda\lib\site-packages\ipykernel\kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "D:\anaconda\lib\site-packages\ipykernel\kernelbase.py", line 235, in dispatch_shell
handler(stream, idents, msg)
File "D:\anaconda\lib\site-packages\ipykernel\kernelbase.py", line 399, in execute_request
user_expressions, allow_stdin)
File "D:\anaconda\lib\site-packages\ipykernel\ipkernel.py", line 196, in do_execute
res = shell.run_cell(code, store_history=store_history, silent=silent)
File "D:\anaconda\lib\site-packages\ipykernel\zmqshell.py", line 533, in run_cell
return super(ZMQInteractiveShell, self).run_cell(*args, **kwargs)
File "D:\anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 2717, in run_cell
interactivity=interactivity, compiler=compiler, result=result)
File "D:\anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 2821, in run_ast_nodes
if self.run_code(code, result):
File "D:\anaconda\lib\site-packages\IPython\core\interactiveshell.py", line 2881, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 7, in
tf.import_graph_def(od_graph_def, name='')
File "D:\anaconda\lib\site-packages\tensorflow\python\framework\importer.py", line 313, in import_graph_def
op_def=op_def)
File "D:\anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 2956, in create_op
op_def=op_def)
File "D:\anaconda\lib\site-packages\tensorflow\python\framework\ops.py", line 1470, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

InvalidArgumentError (see above for traceback): NodeDef mentions attr 'identical_element_shapes' not in Op<name=TensorArrayV3; signature=size:int32 -> handle:resource, flow:float; attr=dtype:type; attr=element_shape:shape,default=; attr=dynamic_size:bool,default=false; attr=clear_after_read:bool,default=true; attr=tensor_array_name:string,default=""; is_stateful=true>; NodeDef: Preprocessor/map/TensorArray = TensorArrayV3clear_after_read=true, dtype=DT_FLOAT, dynamic_size=false, element_shape=, identical_element_shapes=true, tensor_array_name="", _device="/job:localhost/replica:0/task:0/device:CPU:0". (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).
[[Node: Preprocessor/map/TensorArray = TensorArrayV3clear_after_read=true, dtype=DT_FLOAT, dynamic_size=false, element_shape=, identical_element_shapes=true, tensor_array_name="", _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

handwriting_recognition data set format

Hi.

I'm trying to excute your handwriting_recognition/English_Writer_Identification.ipynb jupyter notebook file. But I think your data set is quite different format to IAM data set.

Did you reorganize the data?
If you didn't do anything to data, How to excute jupyter notebook code properly with data?

can't find trained weights file?

I was able to train car damage detection example. But after training, I could not locate the weight file(.h5). When I run inspect_custom_model.ipynb it gives the error that could not find mask_rcnn_damage.h5 file.

Link missing on README

mask_rcnn_damage_detection README has no link where it says:

Please see it at the link below:

Getting this error

tensorflow.python.framework.errors_impl.NotFoundError: /home/arslan993/Desktop/tensorflow_toy_detector/input/annotations/trainval.txt; No such file or directory

Where is the trainval.txt file

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.