Giter Club home page Giter Club logo

keras-maskrcnn's Issues

Incorrect masks shape?

I feed the following images to network:
Image batch shape: (8, 768, 768, 3)

    outputs = model.predict_on_batch(image)

    boxes = outputs[-4]
    scores = outputs[-3]
    labels = outputs[-2]
    masks = outputs[-1]

Detections shape: (8, 100, 4) (8, 100) (8, 100) (1, 100, 28, 28, 1)
I expect masks shape to be (8, 100, 28, 28, 1)
Am I missing something?

Faster retraining with new classes.

How to add more classes to predict without retraining whole network from ImageNet weights? May be it will be useful to save backbone, regression, classification and mask subnet weights separately.

mask size and position

Where is the origin of the mask: in the upper left corner of the image or bbox? And what is the size of the mask: the size of the picture or the size of the bbox?

Train fails

...
Epoch 00010: saving model to /var/tmp/bat/snapshots/resnet50_csv_10.h5
1564 instances of class java-classic with average precision: 0.9435
1650 instances of class vogue-menthe with average precision: 0.9563
mAP: 0.9499
Epoch 11/50
10000/10000 [==============================] - 7936s 794ms/step - loss: 0.2792 - regression_loss: 0.1874 - classification_loss: 0.0191 - masks_loss: 0.0727

Epoch 00011: saving model to /var/tmp/bat/snapshots/resnet50_csv_11.h5
Traceback (most recent call last):
  File "/home/michael/keras-maskrcnn/keras_maskrcnn/bin/train.py", line 313, in <module>
    main()
  File "/home/michael/keras-maskrcnn/keras_maskrcnn/bin/train.py", line 309, in main
    max_queue_size=1,
  File "/home/michael/.local/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/home/michael/.local/lib/python3.5/site-packages/keras/engine/training.py", line 1418, in fit_generator
    initial_epoch=initial_epoch)
  File "/home/michael/.local/lib/python3.5/site-packages/keras/engine/training_generator.py", line 251, in fit_generator
    callbacks.on_epoch_end(epoch, epoch_logs)
  File "/home/michael/.local/lib/python3.5/site-packages/keras/callbacks.py", line 79, in on_epoch_end
    callback.on_epoch_end(epoch, logs)
  File "/home/michael/.local/lib/python3.5/site-packages/keras_retinanet/callbacks/common.py", line 31, in on_epoch_end
    self.callback.on_epoch_end(epoch, logs=logs)
  File "/home/michael/keras-maskrcnn/keras_maskrcnn/bin/../../keras_maskrcnn/callbacks/eval.py", line 66, in on_epoch_end
    save_path=self.save_path
  File "/home/michael/keras-maskrcnn/keras_maskrcnn/bin/../../keras_maskrcnn/utils/eval.py", line 212, in evaluate
    mask = cv2.resize(mask, (box[2] - box[0], box[3] - box[1]))
cv2.error: OpenCV(3.4.3) /io/opencv/modules/imgproc/src/resize.cpp:4045: error: (-215:Assertion failed) !dsize.empty() || (inv_scale_x > 0 && inv_scale_y > 0) in function 'resize'

Callbacks removed from train.py in latest 2 commits?

It appears to me (although I am new to Keras) that the callbacks argument has been inadvertently removed from the call to fit_generator in train.py in the latest two commits. Or maybe it is intentional and I am not calling train.py correctly? In my case, I could not save snapshots after each epoch unless I restored the "callbacks=callbacks," line in the argument list for fit_generator. Thanks.

Saving most recent weights

Is there an option to keep the most recent weights and erase previous weights similar to the max to keep option as it causes memory issues when trained for more epochs.

How to train the model to detecte objects only?

How can I close the branch used to Object Segmentation task?I only have images and the corresponding border and category information.Hence how to modify the codes to only detecte the objects?Thanks!

Train error

When csv file do not contain any mask, this error rising:

Using TensorFlow backend.
2018-11-05 17:07:01.724184: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2018-11-05 17:07:02.346433: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:964] 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-11-05 17:07:02.347048: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 0 with properties:
name: GeForce GTX 1080 major: 6 minor: 1 memoryClockRate(GHz): 1.7335
pciBusID: 0000:01:00.0
totalMemory: 7.92GiB freeMemory: 7.80GiB
2018-11-05 17:07:02.347075: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 0
2018-11-05 17:07:02.531325: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-11-05 17:07:02.531370: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977]      0
2018-11-05 17:07:02.531375: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0:   N
2018-11-05 17:07:02.531522: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1103] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 7528 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1080, pci bus id: 0000:01:00.0, compute capability: 6.1)
Creating model, this may take a second...
../keras-maskrcnn/keras_maskrcnn/bin/train.py:79: UserWarning: Output "filtered_detections" missing from loss dictionary. We assume this was done on purpose, and we will not be expecting any data to be passed to "filtered_detections" during training.
  optimizer=keras.optimizers.adam(lr=1e-5, clipnorm=0.001)
../keras-maskrcnn/keras_maskrcnn/bin/train.py:79: UserWarning: Output "mask_submodel" missing from loss dictionary. We assume this was done on purpose, and we will not be expecting any data to be passed to "mask_submodel" during training.
  optimizer=keras.optimizers.adam(lr=1e-5, clipnorm=0.001)
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to
==================================================================================================
image (InputLayer)              (None, None, None, 3 0
__________________________________________________________________________________________________
padding_conv1 (ZeroPadding2D)   (None, None, None, 3 0           image[0][0]
__________________________________________________________________________________________________
conv1 (Conv2D)                  (None, None, None, 6 9408        padding_conv1[0][0]
__________________________________________________________________________________________________
bn_conv1 (BatchNormalization)   (None, None, None, 6 256         conv1[0][0]
__________________________________________________________________________________________________
conv1_relu (Activation)         (None, None, None, 6 0           bn_conv1[0][0]
__________________________________________________________________________________________________
pool1 (MaxPooling2D)            (None, None, None, 6 0           conv1_relu[0][0]
__________________________________________________________________________________________________
res2a_branch2a (Conv2D)         (None, None, None, 6 4096        pool1[0][0]
__________________________________________________________________________________________________
bn2a_branch2a (BatchNormalizati (None, None, None, 6 256         res2a_branch2a[0][0]
__________________________________________________________________________________________________
res2a_branch2a_relu (Activation (None, None, None, 6 0           bn2a_branch2a[0][0]
__________________________________________________________________________________________________
padding2a_branch2b (ZeroPadding (None, None, None, 6 0           res2a_branch2a_relu[0][0]
__________________________________________________________________________________________________
res2a_branch2b (Conv2D)         (None, None, None, 6 36864       padding2a_branch2b[0][0]
__________________________________________________________________________________________________
bn2a_branch2b (BatchNormalizati (None, None, None, 6 256         res2a_branch2b[0][0]
__________________________________________________________________________________________________
res2a_branch2b_relu (Activation (None, None, None, 6 0           bn2a_branch2b[0][0]
__________________________________________________________________________________________________
res2a_branch2c (Conv2D)         (None, None, None, 2 16384       res2a_branch2b_relu[0][0]
__________________________________________________________________________________________________
res2a_branch1 (Conv2D)          (None, None, None, 2 16384       pool1[0][0]
__________________________________________________________________________________________________
bn2a_branch2c (BatchNormalizati (None, None, None, 2 1024        res2a_branch2c[0][0]
__________________________________________________________________________________________________
bn2a_branch1 (BatchNormalizatio (None, None, None, 2 1024        res2a_branch1[0][0]
__________________________________________________________________________________________________
res2a (Add)                     (None, None, None, 2 0           bn2a_branch2c[0][0]
                                                                 bn2a_branch1[0][0]
__________________________________________________________________________________________________
res2a_relu (Activation)         (None, None, None, 2 0           res2a[0][0]
__________________________________________________________________________________________________
res2b_branch2a (Conv2D)         (None, None, None, 6 16384       res2a_relu[0][0]
__________________________________________________________________________________________________
bn2b_branch2a (BatchNormalizati (None, None, None, 6 256         res2b_branch2a[0][0]
__________________________________________________________________________________________________
res2b_branch2a_relu (Activation (None, None, None, 6 0           bn2b_branch2a[0][0]
__________________________________________________________________________________________________
padding2b_branch2b (ZeroPadding (None, None, None, 6 0           res2b_branch2a_relu[0][0]
__________________________________________________________________________________________________
res2b_branch2b (Conv2D)         (None, None, None, 6 36864       padding2b_branch2b[0][0]
__________________________________________________________________________________________________
bn2b_branch2b (BatchNormalizati (None, None, None, 6 256         res2b_branch2b[0][0]
__________________________________________________________________________________________________
res2b_branch2b_relu (Activation (None, None, None, 6 0           bn2b_branch2b[0][0]
__________________________________________________________________________________________________
res2b_branch2c (Conv2D)         (None, None, None, 2 16384       res2b_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn2b_branch2c (BatchNormalizati (None, None, None, 2 1024        res2b_branch2c[0][0]
__________________________________________________________________________________________________
res2b (Add)                     (None, None, None, 2 0           bn2b_branch2c[0][0]
                                                                 res2a_relu[0][0]
__________________________________________________________________________________________________
res2b_relu (Activation)         (None, None, None, 2 0           res2b[0][0]
__________________________________________________________________________________________________
res2c_branch2a (Conv2D)         (None, None, None, 6 16384       res2b_relu[0][0]
__________________________________________________________________________________________________
bn2c_branch2a (BatchNormalizati (None, None, None, 6 256         res2c_branch2a[0][0]
__________________________________________________________________________________________________
res2c_branch2a_relu (Activation (None, None, None, 6 0           bn2c_branch2a[0][0]
__________________________________________________________________________________________________
padding2c_branch2b (ZeroPadding (None, None, None, 6 0           res2c_branch2a_relu[0][0]
__________________________________________________________________________________________________
res2c_branch2b (Conv2D)         (None, None, None, 6 36864       padding2c_branch2b[0][0]
__________________________________________________________________________________________________
bn2c_branch2b (BatchNormalizati (None, None, None, 6 256         res2c_branch2b[0][0]
__________________________________________________________________________________________________
res2c_branch2b_relu (Activation (None, None, None, 6 0           bn2c_branch2b[0][0]
__________________________________________________________________________________________________
res2c_branch2c (Conv2D)         (None, None, None, 2 16384       res2c_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn2c_branch2c (BatchNormalizati (None, None, None, 2 1024        res2c_branch2c[0][0]
__________________________________________________________________________________________________
res2c (Add)                     (None, None, None, 2 0           bn2c_branch2c[0][0]
                                                                 res2b_relu[0][0]
__________________________________________________________________________________________________
res2c_relu (Activation)         (None, None, None, 2 0           res2c[0][0]
__________________________________________________________________________________________________
res3a_branch2a (Conv2D)         (None, None, None, 1 32768       res2c_relu[0][0]
__________________________________________________________________________________________________
bn3a_branch2a (BatchNormalizati (None, None, None, 1 512         res3a_branch2a[0][0]
__________________________________________________________________________________________________
res3a_branch2a_relu (Activation (None, None, None, 1 0           bn3a_branch2a[0][0]
__________________________________________________________________________________________________
padding3a_branch2b (ZeroPadding (None, None, None, 1 0           res3a_branch2a_relu[0][0]
__________________________________________________________________________________________________
res3a_branch2b (Conv2D)         (None, None, None, 1 147456      padding3a_branch2b[0][0]
__________________________________________________________________________________________________
bn3a_branch2b (BatchNormalizati (None, None, None, 1 512         res3a_branch2b[0][0]
__________________________________________________________________________________________________
res3a_branch2b_relu (Activation (None, None, None, 1 0           bn3a_branch2b[0][0]
__________________________________________________________________________________________________
res3a_branch2c (Conv2D)         (None, None, None, 5 65536       res3a_branch2b_relu[0][0]
__________________________________________________________________________________________________
res3a_branch1 (Conv2D)          (None, None, None, 5 131072      res2c_relu[0][0]
__________________________________________________________________________________________________
bn3a_branch2c (BatchNormalizati (None, None, None, 5 2048        res3a_branch2c[0][0]
__________________________________________________________________________________________________
bn3a_branch1 (BatchNormalizatio (None, None, None, 5 2048        res3a_branch1[0][0]
__________________________________________________________________________________________________
res3a (Add)                     (None, None, None, 5 0           bn3a_branch2c[0][0]
                                                                 bn3a_branch1[0][0]
__________________________________________________________________________________________________
res3a_relu (Activation)         (None, None, None, 5 0           res3a[0][0]
__________________________________________________________________________________________________
res3b_branch2a (Conv2D)         (None, None, None, 1 65536       res3a_relu[0][0]
__________________________________________________________________________________________________
bn3b_branch2a (BatchNormalizati (None, None, None, 1 512         res3b_branch2a[0][0]
__________________________________________________________________________________________________
res3b_branch2a_relu (Activation (None, None, None, 1 0           bn3b_branch2a[0][0]
__________________________________________________________________________________________________
padding3b_branch2b (ZeroPadding (None, None, None, 1 0           res3b_branch2a_relu[0][0]
__________________________________________________________________________________________________
res3b_branch2b (Conv2D)         (None, None, None, 1 147456      padding3b_branch2b[0][0]
__________________________________________________________________________________________________
bn3b_branch2b (BatchNormalizati (None, None, None, 1 512         res3b_branch2b[0][0]
__________________________________________________________________________________________________
res3b_branch2b_relu (Activation (None, None, None, 1 0           bn3b_branch2b[0][0]
__________________________________________________________________________________________________
res3b_branch2c (Conv2D)         (None, None, None, 5 65536       res3b_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn3b_branch2c (BatchNormalizati (None, None, None, 5 2048        res3b_branch2c[0][0]
__________________________________________________________________________________________________
res3b (Add)                     (None, None, None, 5 0           bn3b_branch2c[0][0]
                                                                 res3a_relu[0][0]
__________________________________________________________________________________________________
res3b_relu (Activation)         (None, None, None, 5 0           res3b[0][0]
__________________________________________________________________________________________________
res3c_branch2a (Conv2D)         (None, None, None, 1 65536       res3b_relu[0][0]
__________________________________________________________________________________________________
bn3c_branch2a (BatchNormalizati (None, None, None, 1 512         res3c_branch2a[0][0]
__________________________________________________________________________________________________
res3c_branch2a_relu (Activation (None, None, None, 1 0           bn3c_branch2a[0][0]
__________________________________________________________________________________________________
padding3c_branch2b (ZeroPadding (None, None, None, 1 0           res3c_branch2a_relu[0][0]
__________________________________________________________________________________________________
res3c_branch2b (Conv2D)         (None, None, None, 1 147456      padding3c_branch2b[0][0]
__________________________________________________________________________________________________
bn3c_branch2b (BatchNormalizati (None, None, None, 1 512         res3c_branch2b[0][0]
__________________________________________________________________________________________________
res3c_branch2b_relu (Activation (None, None, None, 1 0           bn3c_branch2b[0][0]
__________________________________________________________________________________________________
res3c_branch2c (Conv2D)         (None, None, None, 5 65536       res3c_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn3c_branch2c (BatchNormalizati (None, None, None, 5 2048        res3c_branch2c[0][0]
__________________________________________________________________________________________________
res3c (Add)                     (None, None, None, 5 0           bn3c_branch2c[0][0]
                                                                 res3b_relu[0][0]
__________________________________________________________________________________________________
res3c_relu (Activation)         (None, None, None, 5 0           res3c[0][0]
__________________________________________________________________________________________________
res3d_branch2a (Conv2D)         (None, None, None, 1 65536       res3c_relu[0][0]
__________________________________________________________________________________________________
bn3d_branch2a (BatchNormalizati (None, None, None, 1 512         res3d_branch2a[0][0]
__________________________________________________________________________________________________
res3d_branch2a_relu (Activation (None, None, None, 1 0           bn3d_branch2a[0][0]
__________________________________________________________________________________________________
padding3d_branch2b (ZeroPadding (None, None, None, 1 0           res3d_branch2a_relu[0][0]
__________________________________________________________________________________________________
res3d_branch2b (Conv2D)         (None, None, None, 1 147456      padding3d_branch2b[0][0]
__________________________________________________________________________________________________
bn3d_branch2b (BatchNormalizati (None, None, None, 1 512         res3d_branch2b[0][0]
__________________________________________________________________________________________________
res3d_branch2b_relu (Activation (None, None, None, 1 0           bn3d_branch2b[0][0]
__________________________________________________________________________________________________
res3d_branch2c (Conv2D)         (None, None, None, 5 65536       res3d_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn3d_branch2c (BatchNormalizati (None, None, None, 5 2048        res3d_branch2c[0][0]
__________________________________________________________________________________________________
res3d (Add)                     (None, None, None, 5 0           bn3d_branch2c[0][0]
                                                                 res3c_relu[0][0]
__________________________________________________________________________________________________
res3d_relu (Activation)         (None, None, None, 5 0           res3d[0][0]
__________________________________________________________________________________________________
res4a_branch2a (Conv2D)         (None, None, None, 2 131072      res3d_relu[0][0]
__________________________________________________________________________________________________
bn4a_branch2a (BatchNormalizati (None, None, None, 2 1024        res4a_branch2a[0][0]
__________________________________________________________________________________________________
res4a_branch2a_relu (Activation (None, None, None, 2 0           bn4a_branch2a[0][0]
__________________________________________________________________________________________________
padding4a_branch2b (ZeroPadding (None, None, None, 2 0           res4a_branch2a_relu[0][0]
__________________________________________________________________________________________________
res4a_branch2b (Conv2D)         (None, None, None, 2 589824      padding4a_branch2b[0][0]
__________________________________________________________________________________________________
bn4a_branch2b (BatchNormalizati (None, None, None, 2 1024        res4a_branch2b[0][0]
__________________________________________________________________________________________________
res4a_branch2b_relu (Activation (None, None, None, 2 0           bn4a_branch2b[0][0]
__________________________________________________________________________________________________
res4a_branch2c (Conv2D)         (None, None, None, 1 262144      res4a_branch2b_relu[0][0]
__________________________________________________________________________________________________
res4a_branch1 (Conv2D)          (None, None, None, 1 524288      res3d_relu[0][0]
__________________________________________________________________________________________________
bn4a_branch2c (BatchNormalizati (None, None, None, 1 4096        res4a_branch2c[0][0]
__________________________________________________________________________________________________
bn4a_branch1 (BatchNormalizatio (None, None, None, 1 4096        res4a_branch1[0][0]
__________________________________________________________________________________________________
res4a (Add)                     (None, None, None, 1 0           bn4a_branch2c[0][0]
                                                                 bn4a_branch1[0][0]
__________________________________________________________________________________________________
res4a_relu (Activation)         (None, None, None, 1 0           res4a[0][0]
__________________________________________________________________________________________________
res4b_branch2a (Conv2D)         (None, None, None, 2 262144      res4a_relu[0][0]
__________________________________________________________________________________________________
bn4b_branch2a (BatchNormalizati (None, None, None, 2 1024        res4b_branch2a[0][0]
__________________________________________________________________________________________________
res4b_branch2a_relu (Activation (None, None, None, 2 0           bn4b_branch2a[0][0]
__________________________________________________________________________________________________
padding4b_branch2b (ZeroPadding (None, None, None, 2 0           res4b_branch2a_relu[0][0]
__________________________________________________________________________________________________
res4b_branch2b (Conv2D)         (None, None, None, 2 589824      padding4b_branch2b[0][0]
__________________________________________________________________________________________________
bn4b_branch2b (BatchNormalizati (None, None, None, 2 1024        res4b_branch2b[0][0]
__________________________________________________________________________________________________
res4b_branch2b_relu (Activation (None, None, None, 2 0           bn4b_branch2b[0][0]
__________________________________________________________________________________________________
res4b_branch2c (Conv2D)         (None, None, None, 1 262144      res4b_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn4b_branch2c (BatchNormalizati (None, None, None, 1 4096        res4b_branch2c[0][0]
__________________________________________________________________________________________________
res4b (Add)                     (None, None, None, 1 0           bn4b_branch2c[0][0]
                                                                 res4a_relu[0][0]
__________________________________________________________________________________________________
res4b_relu (Activation)         (None, None, None, 1 0           res4b[0][0]
__________________________________________________________________________________________________
res4c_branch2a (Conv2D)         (None, None, None, 2 262144      res4b_relu[0][0]
__________________________________________________________________________________________________
bn4c_branch2a (BatchNormalizati (None, None, None, 2 1024        res4c_branch2a[0][0]
__________________________________________________________________________________________________
res4c_branch2a_relu (Activation (None, None, None, 2 0           bn4c_branch2a[0][0]
__________________________________________________________________________________________________
padding4c_branch2b (ZeroPadding (None, None, None, 2 0           res4c_branch2a_relu[0][0]
__________________________________________________________________________________________________
res4c_branch2b (Conv2D)         (None, None, None, 2 589824      padding4c_branch2b[0][0]
__________________________________________________________________________________________________
bn4c_branch2b (BatchNormalizati (None, None, None, 2 1024        res4c_branch2b[0][0]
__________________________________________________________________________________________________
res4c_branch2b_relu (Activation (None, None, None, 2 0           bn4c_branch2b[0][0]
__________________________________________________________________________________________________
res4c_branch2c (Conv2D)         (None, None, None, 1 262144      res4c_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn4c_branch2c (BatchNormalizati (None, None, None, 1 4096        res4c_branch2c[0][0]
__________________________________________________________________________________________________
res4c (Add)                     (None, None, None, 1 0           bn4c_branch2c[0][0]
                                                                 res4b_relu[0][0]
__________________________________________________________________________________________________
res4c_relu (Activation)         (None, None, None, 1 0           res4c[0][0]
__________________________________________________________________________________________________
res4d_branch2a (Conv2D)         (None, None, None, 2 262144      res4c_relu[0][0]
__________________________________________________________________________________________________
bn4d_branch2a (BatchNormalizati (None, None, None, 2 1024        res4d_branch2a[0][0]
__________________________________________________________________________________________________
res4d_branch2a_relu (Activation (None, None, None, 2 0           bn4d_branch2a[0][0]
__________________________________________________________________________________________________
padding4d_branch2b (ZeroPadding (None, None, None, 2 0           res4d_branch2a_relu[0][0]
__________________________________________________________________________________________________
res4d_branch2b (Conv2D)         (None, None, None, 2 589824      padding4d_branch2b[0][0]
__________________________________________________________________________________________________
bn4d_branch2b (BatchNormalizati (None, None, None, 2 1024        res4d_branch2b[0][0]
__________________________________________________________________________________________________
res4d_branch2b_relu (Activation (None, None, None, 2 0           bn4d_branch2b[0][0]
__________________________________________________________________________________________________
res4d_branch2c (Conv2D)         (None, None, None, 1 262144      res4d_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn4d_branch2c (BatchNormalizati (None, None, None, 1 4096        res4d_branch2c[0][0]
__________________________________________________________________________________________________
res4d (Add)                     (None, None, None, 1 0           bn4d_branch2c[0][0]
                                                                 res4c_relu[0][0]
__________________________________________________________________________________________________
res4d_relu (Activation)         (None, None, None, 1 0           res4d[0][0]
__________________________________________________________________________________________________
res4e_branch2a (Conv2D)         (None, None, None, 2 262144      res4d_relu[0][0]
__________________________________________________________________________________________________
bn4e_branch2a (BatchNormalizati (None, None, None, 2 1024        res4e_branch2a[0][0]
__________________________________________________________________________________________________
res4e_branch2a_relu (Activation (None, None, None, 2 0           bn4e_branch2a[0][0]
__________________________________________________________________________________________________
padding4e_branch2b (ZeroPadding (None, None, None, 2 0           res4e_branch2a_relu[0][0]
__________________________________________________________________________________________________
res4e_branch2b (Conv2D)         (None, None, None, 2 589824      padding4e_branch2b[0][0]
__________________________________________________________________________________________________
bn4e_branch2b (BatchNormalizati (None, None, None, 2 1024        res4e_branch2b[0][0]
__________________________________________________________________________________________________
res4e_branch2b_relu (Activation (None, None, None, 2 0           bn4e_branch2b[0][0]
__________________________________________________________________________________________________
res4e_branch2c (Conv2D)         (None, None, None, 1 262144      res4e_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn4e_branch2c (BatchNormalizati (None, None, None, 1 4096        res4e_branch2c[0][0]
__________________________________________________________________________________________________
res4e (Add)                     (None, None, None, 1 0           bn4e_branch2c[0][0]
                                                                 res4d_relu[0][0]
__________________________________________________________________________________________________
res4e_relu (Activation)         (None, None, None, 1 0           res4e[0][0]
__________________________________________________________________________________________________
res4f_branch2a (Conv2D)         (None, None, None, 2 262144      res4e_relu[0][0]
__________________________________________________________________________________________________
bn4f_branch2a (BatchNormalizati (None, None, None, 2 1024        res4f_branch2a[0][0]
__________________________________________________________________________________________________
res4f_branch2a_relu (Activation (None, None, None, 2 0           bn4f_branch2a[0][0]
__________________________________________________________________________________________________
padding4f_branch2b (ZeroPadding (None, None, None, 2 0           res4f_branch2a_relu[0][0]
__________________________________________________________________________________________________
res4f_branch2b (Conv2D)         (None, None, None, 2 589824      padding4f_branch2b[0][0]
__________________________________________________________________________________________________
bn4f_branch2b (BatchNormalizati (None, None, None, 2 1024        res4f_branch2b[0][0]
__________________________________________________________________________________________________
res4f_branch2b_relu (Activation (None, None, None, 2 0           bn4f_branch2b[0][0]
__________________________________________________________________________________________________
res4f_branch2c (Conv2D)         (None, None, None, 1 262144      res4f_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn4f_branch2c (BatchNormalizati (None, None, None, 1 4096        res4f_branch2c[0][0]
__________________________________________________________________________________________________
res4f (Add)                     (None, None, None, 1 0           bn4f_branch2c[0][0]
                                                                 res4e_relu[0][0]
__________________________________________________________________________________________________
res4f_relu (Activation)         (None, None, None, 1 0           res4f[0][0]
__________________________________________________________________________________________________
res5a_branch2a (Conv2D)         (None, None, None, 5 524288      res4f_relu[0][0]
__________________________________________________________________________________________________
bn5a_branch2a (BatchNormalizati (None, None, None, 5 2048        res5a_branch2a[0][0]
__________________________________________________________________________________________________
res5a_branch2a_relu (Activation (None, None, None, 5 0           bn5a_branch2a[0][0]
__________________________________________________________________________________________________
padding5a_branch2b (ZeroPadding (None, None, None, 5 0           res5a_branch2a_relu[0][0]
__________________________________________________________________________________________________
res5a_branch2b (Conv2D)         (None, None, None, 5 2359296     padding5a_branch2b[0][0]
__________________________________________________________________________________________________
bn5a_branch2b (BatchNormalizati (None, None, None, 5 2048        res5a_branch2b[0][0]
__________________________________________________________________________________________________
res5a_branch2b_relu (Activation (None, None, None, 5 0           bn5a_branch2b[0][0]
__________________________________________________________________________________________________
res5a_branch2c (Conv2D)         (None, None, None, 2 1048576     res5a_branch2b_relu[0][0]
__________________________________________________________________________________________________
res5a_branch1 (Conv2D)          (None, None, None, 2 2097152     res4f_relu[0][0]
__________________________________________________________________________________________________
bn5a_branch2c (BatchNormalizati (None, None, None, 2 8192        res5a_branch2c[0][0]
__________________________________________________________________________________________________
bn5a_branch1 (BatchNormalizatio (None, None, None, 2 8192        res5a_branch1[0][0]
__________________________________________________________________________________________________
res5a (Add)                     (None, None, None, 2 0           bn5a_branch2c[0][0]
                                                                 bn5a_branch1[0][0]
__________________________________________________________________________________________________
res5a_relu (Activation)         (None, None, None, 2 0           res5a[0][0]
__________________________________________________________________________________________________
res5b_branch2a (Conv2D)         (None, None, None, 5 1048576     res5a_relu[0][0]
__________________________________________________________________________________________________
bn5b_branch2a (BatchNormalizati (None, None, None, 5 2048        res5b_branch2a[0][0]
__________________________________________________________________________________________________
res5b_branch2a_relu (Activation (None, None, None, 5 0           bn5b_branch2a[0][0]
__________________________________________________________________________________________________
padding5b_branch2b (ZeroPadding (None, None, None, 5 0           res5b_branch2a_relu[0][0]
__________________________________________________________________________________________________
res5b_branch2b (Conv2D)         (None, None, None, 5 2359296     padding5b_branch2b[0][0]
__________________________________________________________________________________________________
bn5b_branch2b (BatchNormalizati (None, None, None, 5 2048        res5b_branch2b[0][0]
__________________________________________________________________________________________________
res5b_branch2b_relu (Activation (None, None, None, 5 0           bn5b_branch2b[0][0]
__________________________________________________________________________________________________
res5b_branch2c (Conv2D)         (None, None, None, 2 1048576     res5b_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn5b_branch2c (BatchNormalizati (None, None, None, 2 8192        res5b_branch2c[0][0]
__________________________________________________________________________________________________
res5b (Add)                     (None, None, None, 2 0           bn5b_branch2c[0][0]
                                                                 res5a_relu[0][0]
__________________________________________________________________________________________________
res5b_relu (Activation)         (None, None, None, 2 0           res5b[0][0]
__________________________________________________________________________________________________
res5c_branch2a (Conv2D)         (None, None, None, 5 1048576     res5b_relu[0][0]
__________________________________________________________________________________________________
bn5c_branch2a (BatchNormalizati (None, None, None, 5 2048        res5c_branch2a[0][0]
__________________________________________________________________________________________________
res5c_branch2a_relu (Activation (None, None, None, 5 0           bn5c_branch2a[0][0]
__________________________________________________________________________________________________
padding5c_branch2b (ZeroPadding (None, None, None, 5 0           res5c_branch2a_relu[0][0]
__________________________________________________________________________________________________
res5c_branch2b (Conv2D)         (None, None, None, 5 2359296     padding5c_branch2b[0][0]
__________________________________________________________________________________________________
bn5c_branch2b (BatchNormalizati (None, None, None, 5 2048        res5c_branch2b[0][0]
__________________________________________________________________________________________________
res5c_branch2b_relu (Activation (None, None, None, 5 0           bn5c_branch2b[0][0]
__________________________________________________________________________________________________
res5c_branch2c (Conv2D)         (None, None, None, 2 1048576     res5c_branch2b_relu[0][0]
__________________________________________________________________________________________________
bn5c_branch2c (BatchNormalizati (None, None, None, 2 8192        res5c_branch2c[0][0]
__________________________________________________________________________________________________
res5c (Add)                     (None, None, None, 2 0           bn5c_branch2c[0][0]
                                                                 res5b_relu[0][0]
__________________________________________________________________________________________________
res5c_relu (Activation)         (None, None, None, 2 0           res5c[0][0]
__________________________________________________________________________________________________
C5_reduced (Conv2D)             (None, None, None, 2 524544      res5c_relu[0][0]
__________________________________________________________________________________________________
P5_upsampled (UpsampleLike)     (None, None, None, 2 0           C5_reduced[0][0]
                                                                 res4f_relu[0][0]
__________________________________________________________________________________________________
C4_reduced (Conv2D)             (None, None, None, 2 262400      res4f_relu[0][0]
__________________________________________________________________________________________________
P4_merged (Add)                 (None, None, None, 2 0           P5_upsampled[0][0]
                                                                 C4_reduced[0][0]
__________________________________________________________________________________________________
P4_upsampled (UpsampleLike)     (None, None, None, 2 0           P4_merged[0][0]
                                                                 res3d_relu[0][0]
__________________________________________________________________________________________________
C3_reduced (Conv2D)             (None, None, None, 2 131328      res3d_relu[0][0]
__________________________________________________________________________________________________
P6 (Conv2D)                     (None, None, None, 2 4718848     res5c_relu[0][0]
__________________________________________________________________________________________________
P3_merged (Add)                 (None, None, None, 2 0           P4_upsampled[0][0]
                                                                 C3_reduced[0][0]
__________________________________________________________________________________________________
C6_relu (Activation)            (None, None, None, 2 0           P6[0][0]
__________________________________________________________________________________________________
P3 (Conv2D)                     (None, None, None, 2 590080      P3_merged[0][0]
__________________________________________________________________________________________________
P4 (Conv2D)                     (None, None, None, 2 590080      P4_merged[0][0]
__________________________________________________________________________________________________
P5 (Conv2D)                     (None, None, None, 2 590080      C5_reduced[0][0]
__________________________________________________________________________________________________
P7 (Conv2D)                     (None, None, None, 2 590080      C6_relu[0][0]
__________________________________________________________________________________________________
regression_submodel (Model)     (None, None, 4)      2443300     P3[0][0]
                                                                 P4[0][0]
                                                                 P5[0][0]
                                                                 P6[0][0]
                                                                 P7[0][0]
__________________________________________________________________________________________________
anchors_0 (Anchors)             (None, None, 4)      0           P3[0][0]
__________________________________________________________________________________________________
anchors_1 (Anchors)             (None, None, 4)      0           P4[0][0]
__________________________________________________________________________________________________
anchors_2 (Anchors)             (None, None, 4)      0           P5[0][0]
__________________________________________________________________________________________________
anchors_3 (Anchors)             (None, None, 4)      0           P6[0][0]
__________________________________________________________________________________________________
anchors_4 (Anchors)             (None, None, 4)      0           P7[0][0]
__________________________________________________________________________________________________
regression (Concatenate)        (None, None, 4)      0           regression_submodel[1][0]
                                                                 regression_submodel[2][0]
                                                                 regression_submodel[3][0]
                                                                 regression_submodel[4][0]
                                                                 regression_submodel[5][0]
__________________________________________________________________________________________________
anchors (Concatenate)           (None, None, 4)      0           anchors_0[0][0]
                                                                 anchors_1[0][0]
                                                                 anchors_2[0][0]
                                                                 anchors_3[0][0]
                                                                 anchors_4[0][0]
__________________________________________________________________________________________________
classification_submodel (Model) (None, None, 97)     4372585     P3[0][0]
                                                                 P4[0][0]
                                                                 P5[0][0]
                                                                 P6[0][0]
                                                                 P7[0][0]
__________________________________________________________________________________________________
boxes (RegressBoxes)            (None, None, 4)      0           anchors[0][0]
                                                                 regression[0][0]
__________________________________________________________________________________________________
classification (Concatenate)    (None, None, 97)     0           classification_submodel[1][0]
                                                                 classification_submodel[2][0]
                                                                 classification_submodel[3][0]
                                                                 classification_submodel[4][0]
                                                                 classification_submodel[5][0]
__________________________________________________________________________________________________
clipped_boxes (ClipBoxes)       (None, None, 4)      0           image[0][0]
                                                                 boxes[0][0]
__________________________________________________________________________________________________
filtered_detections (FilterDete [(None, 100, 4), (No 0           clipped_boxes[0][0]
                                                                 classification[0][0]
__________________________________________________________________________________________________
shape_1 (Shape)                 (4,)                 0           image[0][0]
__________________________________________________________________________________________________
roi_align_1 (RoiAlign)          (None, None, 14, 14, 0           shape_1[0][0]
                                                                 filtered_detections[0][0]
                                                                 filtered_detections[0][1]
                                                                 P3[0][0]
                                                                 P4[0][0]
                                                                 P5[0][0]
                                                                 P6[0][0]
                                                                 P7[0][0]
__________________________________________________________________________________________________
mask_submodel (Model)           (None, None, 28, 28, 2975329     roi_align_1[0][0]
__________________________________________________________________________________________________
masks (ConcatenateBoxes)        (None, 100, 76052)   0           filtered_detections[0][0]
                                                                 mask_submodel[1][0]
==================================================================================================
Total params: 41,349,806
Trainable params: 41,243,566
Non-trainable params: 106,240
__________________________________________________________________________________________________
None
/home/xxxxxx/.local/lib/python3.5/site-packages/keras/callbacks.py:1065: UserWarning: `epsilon` argument is deprecated and will be removed, use `min_delta` instead.
  warnings.warn('`epsilon` argument is deprecated and '
/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gradients_impl.py:108: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
  "Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
Epoch 1/50
Traceback (most recent call last):
  File "../keras-maskrcnn/keras_maskrcnn/bin/train.py", line 313, in <module>
    main()
  File "../keras-maskrcnn/keras_maskrcnn/bin/train.py", line 309, in main
    max_queue_size=1,
  File "/home/xxxxxx/.local/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/home/xxxxxx/.local/lib/python3.5/site-packages/keras/engine/training.py", line 1418, in fit_generator
    initial_epoch=initial_epoch)
  File "/home/xxxxxx/.local/lib/python3.5/site-packages/keras/engine/training_generator.py", line 181, in fit_generator
    generator_output = next(output_generator)
  File "/home/xxxxxx/.local/lib/python3.5/site-packages/keras/utils/data_utils.py", line 709, in get
    six.reraise(*sys.exc_info())
  File "/home/xxxxxx/.local/lib/python3.5/site-packages/six.py", line 693, in reraise
    raise value
  File "/home/xxxxxx/.local/lib/python3.5/site-packages/keras/utils/data_utils.py", line 685, in get
    inputs = self.queue.get(block=True).get()
  File "/usr/lib/python3.5/multiprocessing/pool.py", line 608, in get
    raise self._value
  File "/usr/lib/python3.5/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/home/xxxxxx/.local/lib/python3.5/site-packages/keras/utils/data_utils.py", line 626, in next_sample
    return six.next(_SHARED_SEQUENCES[uid])
  File "../keras-maskrcnn/keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 266, in __next__
    return self.next()
  File "../keras-maskrcnn/keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 277, in next
    return self.compute_input_output(group)
  File "../keras-maskrcnn/keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 249, in compute_input_output
    annotations_group = self.load_annotations_group(group)
  File "../keras-maskrcnn/keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 93, in load_annotations_group
    return [self.load_annotations(image_index) for image_index in group]
  File "../keras-maskrcnn/keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 93, in <listcomp>
    return [self.load_annotations(image_index) for image_index in group]
  File "../keras-maskrcnn/keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/csv_generator.py", line 186, in load_annotations
    mask = (mask > 0).astype(np.uint8)  # convert from 0-255 to binary mask
TypeError: unorderable types: NoneType() > int()

Mask loss fails on empty masks

The mask loss makes the training process crash if an image doesn't contain any annotations (and therefore has no masks).

Error in random_transform of mask

I have a custom dataset consisting of 900 x 900 images that are annotated in the COCO format. When I try to train the model, I'm getting this error.

Traceback (most recent call last):                                                                             
  File "/usr/lib/python3.5/multiprocessing/pool.py", line 119, in worker                                       
    result = (True, func(*args, **kwds))                                                                       
  File "/root/.local/lib/python3.5/site-packages/keras/utils/data_utils.py", line 401, in get_index            
    return _SHARED_SEQUENCES[uid][i]                                                                           
  File "keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 287, in __getitem__    
    inputs, targets = self.compute_input_output(group) 
File "keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 265, in compute_input_
image_group, annotations_group = self.preprocess_group(image_group, annotations_group)                               
  File "keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 188, in preprocess_group     
    image, annotations = self.preprocess_group_entry(image, annotations)                                       
  File "keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 168, in preprocess_group_entry                                                                                                              
    image, annotations = self.random_transform_group_entry(image, annotations)                                 
  File "keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 145, in random_transform_group_entry                                                                                                        
    annotations['masks'][i] = apply_transform(transform, mask, self.transform_parameters)                      
ValueError: could not broadcast input array from shape (900,900) into shape (900,900,1)                        
"""                                                                                                            
                                                                                                               
The above exception was the direct cause of the following exception:                                           
                                                                                                               
Traceback (most recent call last):                                                                             
  File "keras_maskrcnn/bin/train.py", line 325, in <module>                                                    
    main()                                                                                                     
  File "keras_maskrcnn/bin/train.py", line 321, in main                                                        
    max_queue_size=args.max_queue_size                                                                         
  File "/root/.local/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper              
    return func(*args, **kwargs)                                                                               
  File "/root/.local/lib/python3.5/site-packages/keras/engine/training.py", line 1418, in fit_generator        
    initial_epoch=initial_epoch)                                                                               
  File "/root/.local/lib/python3.5/site-packages/keras/engine/training_generator.py", line 181, in fit_generator                                                                                                              
    generator_output = next(output_generator)                                                                  
  File "/root/.local/lib/python3.5/site-packages/keras/utils/data_utils.py", line 601, in get                  
    six.reraise(*sys.exc_info())                                                                               
  File "/usr/local/lib/python3.5/dist-packages/six.py", line 693, in reraise                                   
    raise value                                                                                                
  File "/root/.local/lib/python3.5/site-packages/keras/utils/data_utils.py", line 595, in get                  
    inputs = self.queue.get(block=True).get()                                                                 
  File "/usr/lib/python3.5/multiprocessing/pool.py", line 608, in get                                          
    raise self._value                                                                                          
ValueError: could not broadcast input array from shape (900,900) into shape (900,900,1) 

random

I understand that the random transformation of masks involve adding an extra 'fake' channel. However it seems the mask I get from annotations['masks'] is already of shape (900,900,1). In addition to the error, I'm confused as to why the mask is set to be the the size of the image and why it already has an extra dimension.

Would you happen to have an idea as to what could be causing this?

Syntax error while running train.py

$ ./keras_maskrcnn/bin/train.py coco ~/Downloads/train2017/
/home/ros/.local/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
Using TensorFlow backend.
Traceback (most recent call last):
  File "./keras_maskrcnn/bin/train.py", line 288, in <module>
    main()
  File "./keras_maskrcnn/bin/train.py", line 235, in main
    backbone = models.backbone(args.backbone)
  File "./keras_maskrcnn/bin/../../keras_maskrcnn/models/__init__.py", line 33, in backbone
    from .resnet import ResNetBackbone as b
  File "./keras_maskrcnn/bin/../../keras_maskrcnn/models/resnet.py", line 23, in <module>
    from ..models import retinanet, Backbone
  File "./keras_maskrcnn/bin/../../keras_maskrcnn/models/retinanet.py", line 32
    **options,
             ^
SyntaxError: invalid syntax

Could not satisfy explicit device specification?

Hi, I've tried training maskrcnn on a custom dataset, and I'm getting the following crash,
It seems to come from tensorflow, I've now installed multiple versions, and tested on titan and 1070 same result.

Could it have something to do with this?
google/prettytensor#1

Running Ubuntu 16, keras 2.2.4, tensorflow 1.4

Any ideas?

/media/felix/MongoDB/Train_Test/Knox/mask5/lib/python3.5/site-packages/keras/callbacks.py:1065: UserWarning: epsilon argument is deprecated and will be removed, use min_delta instead.
warnings.warn('epsilon argument is deprecated and '
/media/felix/MongoDB/Train_Test/Knox/mask5/lib/python3.5/site-packages/tensorflow/python/ops/gradients_impl.py:95: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
"Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
Traceback (most recent call last):
File "/media/felix/MongoDB/Train_Test/Knox/mask5/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1327, in _do_call
return fn(*args)
File "/media/felix/MongoDB/Train_Test/Knox/mask5/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1297, in _run_fn
self._extend_graph()
File "/media/felix/MongoDB/Train_Test/Knox/mask5/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1358, in _extend_graph
self._session, graph_def.SerializeToString(), status)
File "/usr/lib/python3.5/contextlib.py", line 66, in exit
next(self.gen)
File "/media/felix/MongoDB/Train_Test/Knox/mask5/lib/python3.5/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.InvalidArgumentError: Cannot assign a device for operation 'training/Adam/gradients/filtered_detections/map/while/embedding_lookup_5_grad/Reshape_1/f_acc': Could not satisfy explicit device specification '' because the node was colocated with a group of nodes that required incompatible device '/job:localhost/replica:0/task:0/device:GPU:0'
Colocation Debug Info:
Colocation group had the following types and devices:
Gather: GPU CPU
ConcatV2: GPU CPU
StridedSlice: CPU
Cast: GPU CPU
TensorArrayGradV3: GPU CPU
Pack: GPU CPU
RefEnter: GPU CPU
Enter: GPU CPU
ExpandDims: GPU CPU
StackPop: GPU CPU
Stack: GPU CPU
TensorArrayReadV3: GPU CPU
Reshape: GPU CPU
UnsortedSegmentSum: GPU CPU
Identity: GPU CPU
TensorArrayGatherV3: GPU CPU
TensorArrayV3: GPU CPU
Unpack: GPU CPU
TensorArrayScatterV3: GPU CPU
Const: GPU CPU
TensorArrayWriteV3: GPU CPU
Shape: GPU CPU
Size: GPU CPU
StackPush: GPU CPU
[[Node: training/Adam/gradients/filtered_detections/map/while/embedding_lookup_5_grad/Reshape_1/f_acc = Stack_class=["loc:@filtered_detections/map/while/TensorArrayReadV3", "loc:@filtered_detections/map/while/strided_slice_10"], elem_type=DT_INT64, stack_name=""]]

'Resize method is not implemented.

There are no ResizeMethod.NEAREST in tf.image.resize_images and the code is calling it

def call(self, inputs, **kwargs):
    return keras_retinanet.backend.resize_images(inputs, (self.target_size[0], self.target_size[1]), method='nearest')
 File "D:/repos/keras-maskrcnn/keras_maskrcnn/bin\..\..\keras_maskrcnn\layers\upsample.py", line 30, in call
    return keras_retinanet.backend.resize_images(inputs, (self.target_size[0], self.target_size[1]), method='nearest')
  File "C:\Users\User\AppData\Roaming\Python\Python36\site-packages\keras_retinanet\backend\tensorflow_backend.py", line 38, in resize_images
    return tensorflow.image.resize_images(*args, **kwargs)
  File "C:\Users\User\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\ops\image_ops_impl.py", line 939, in resize_images
    raise ValueError('Resize method is not implemented.')

Mask colors

Just to clarify.
For my own dataset I should create csv file in valid format. It's clear.
But when I create mask pictures, should I use the same color for all mask of the same class?
For example:
for cow always red
for cat always blue
etc

Also if I have several cows on picture with some superposition, should I create masks with at least 1 pixel between two objects?

Not really an issue but a question

When creating my own CSV file for keras-maskrcnn training, how many different classes do I have to include? Can I have only one object class such as tumor across all images? Or does it has to be something like 'tumor' vs. 'kidney', meaning at least two object classes? Thank you.

mask is none

A part of my "annotations.csv" file is :

JPEGImages/20130320T004351.039789.Cam6_32.png,,,,,,
JPEGImages/20130320T004351.801805.Cam6_43.png,,,,,,
JPEGImages/20130320T004351.992184.Cam6_61.png,193,105,232,145,apple,masks/20130320T004351.992184.Cam6_61.png
JPEGImages/20130320T004351.992184.Cam6_61.png,131,107,170,147,apple,masks/20130320T004351.992184.Cam6_61.png

And classes file is

apple,0

But, when I trained these data, I had a issue.

Epoch 1/50
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/home/cbf/anaconda3/envs/tfGPU/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/home/cbf/anaconda3/envs/tfGPU/lib/python3.6/site-packages/keras/utils/data_utils.py", line 401, in get_index
return _SHARED_SEQUENCES[uid][i]
File "keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 284, in getitem
inputs, targets = self.compute_input_output(group)
File "keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 256, in compute_input_output
annotations_group = self.load_annotations_group(group)
File "keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 97, in load_annotations_group
return [self.load_annotations(image_index) for image_index in group]
File "keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/generator.py", line 97, in
return [self.load_annotations(image_index) for image_index in group]
File "keras_maskrcnn/bin/../../keras_maskrcnn/preprocessing/csv_generator.py", line 186, in load_annotations
mask = (mask > 0).astype(np.uint8) # convert from 0-255 to binary mask
TypeError: '>' not supported between instances of 'NoneType' and 'int'
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "keras_maskrcnn/bin/train.py", line 325, in
main()
File "keras_maskrcnn/bin/train.py", line 321, in main
max_queue_size=args.max_queue_size
File "/home/cbf/anaconda3/envs/tfGPU/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/home/cbf/anaconda3/envs/tfGPU/lib/python3.6/site-packages/keras/engine/training.py", line 1418, in fit_generator
initial_epoch=initial_epoch)
File "/home/cbf/anaconda3/envs/tfGPU/lib/python3.6/site-packages/keras/engine/training_generator.py", line 181, in fit_generator
generator_output = next(output_generator)
File "/home/cbf/anaconda3/envs/tfGPU/lib/python3.6/site-packages/keras/utils/data_utils.py", line 601, in get
six.reraise(*sys.exc_info())
File "/home/cbf/anaconda3/envs/tfGPU/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/home/cbf/anaconda3/envs/tfGPU/lib/python3.6/site-packages/keras/utils/data_utils.py", line 595, in get
inputs = self.queue.get(block=True).get()
File "/home/cbf/anaconda3/envs/tfGPU/lib/python3.6/multiprocessing/pool.py", line 644, in get
raise self._value
TypeError: '>' not supported between instances of 'NoneType' and 'int'

It may be mask is none. I don't know is the issue about data or code.
How can I change?

OOM

OM when allocating tensor with shape[100,256,28,28] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc

Traceback (most recent call last):
File "keras_maskrcnn/bin/train.py", line 314, in
main()
File "keras_maskrcnn/bin/train.py", line 310, in main
max_queue_size=1,
File "/home/devinda/libs/keras-maskrcnn/.env/local/lib/python2.7/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/home/devinda/libs/keras-maskrcnn/.env/local/lib/python2.7/site-packages/keras/engine/training.py", line 1418, in fit_generator
initial_epoch=initial_epoch)
File "/home/devinda/libs/keras-maskrcnn/.env/local/lib/python2.7/site-packages/keras/engine/training_generator.py", line 217, in fit_generator
class_weight=class_weight)
File "/home/devinda/libs/keras-maskrcnn/.env/local/lib/python2.7/site-packages/keras/engine/training.py", line 1217, in train_on_batch
outputs = self.train_function(ins)
File "/home/devinda/libs/keras-maskrcnn/.env/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 2715, in call
return self._call(inputs)
File "/home/devinda/libs/keras-maskrcnn/.env/local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 2675, in _call
fetched = self._callable_fn(*array_vals)
File "/home/devinda/libs/keras-maskrcnn/.env/local/lib/python2.7/site-packages/tensorflow/python/client/session.py", line 1399, in call
run_metadata_ptr)
File "/home/devinda/libs/keras-maskrcnn/.env/local/lib/python2.7/site-packages/tensorflow/python/framework/errors_impl.py", line 526, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[100,256,28,28] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
[[{{node training/Adam/gradients/mask_submodel/roi_mask_features/convolution_grad/Conv2DBackpropFilter-0-TransposeNHWCToNCHW-LayoutOptimizer}} = Transpose[T=DT_FLOAT, Tperm=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"](mask_submodel/roi_mask_upsample/resize_images/ResizeNearestNeighbor, PermConstNHWCToNCHW-LayoutOptimizer)]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

Mask per instace or mask per class?

I generate synthetic dataset and try to train on it. I found example:

/data/imgs/img_001.jpg,837,346,981,456,cow,/data/masks/img_001_001.png
/data/imgs/img_002.jpg,215,312,279,391,cat,/data/masks/img_002_001.png
/data/imgs/img_002.jpg,22,5,89,84,bird,/data/masks/img_002_002.png
/data/imgs/img_003.jpg,,,,,,

/data/masks/img_001_001.png - is it mask for all cows on /data/imgs/img_001.jpg , or it containing mask for only one cow located inside bbox(837,346,981,456) ?

'It looks like you are subclassing `Model` and you '

I would like to retrain the maskrcnn from the released model. But I got errors below:


/home/wen/anaconda3/bin/python /home/wen/net_project/MASK/Mask_RCNN-master/samples/coco/coco.py train --dataset=/home/wen/net_project/MASK/data/ --model=/home/wen/net_project/MASK/Mask_RCNN-master/weight/resnet50_coco_v0.1.0.h5
Using TensorFlow backend.
Command: train
Model: /home/wen/net_project/MASK/Mask_RCNN-master/weight/resnet50_coco_v0.1.0.h5
Dataset: /home/wen/net_project/MASK/data/
Year: 2014
Logs: /home/wen/net_project/MASK/Mask_RCNN-master/logs
Auto Download: False

Configurations:
BACKBONE resnet50
BACKBONE_STRIDES [4, 8, 16, 32, 64]
BATCH_SIZE 8
BBOX_STD_DEV [0.1 0.1 0.2 0.2]
COMPUTE_BACKBONE_SHAPE None
DETECTION_MAX_INSTANCES 100
DETECTION_MIN_CONFIDENCE 0.7
DETECTION_NMS_THRESHOLD 0.3
FPN_CLASSIF_FC_LAYERS_SIZE 1024
GPU_COUNT 4
GRADIENT_CLIP_NORM 5.0
IMAGES_PER_GPU 2
IMAGE_MAX_DIM 1024
IMAGE_META_SIZE 93
IMAGE_MIN_DIM 800
IMAGE_MIN_SCALE 0
IMAGE_RESIZE_MODE square
IMAGE_SHAPE [1024 1024 3]
LEARNING_MOMENTUM 0.9
LEARNING_RATE 0.001
LOSS_WEIGHTS {'rpn_class_loss': 1.0, 'rpn_bbox_loss': 1.0, 'mrcnn_class_loss': 1.0, 'mrcnn_bbox_loss': 1.0, 'mrcnn_mask_loss': 1.0}
MASK_POOL_SIZE 14
MASK_SHAPE [28, 28]
MAX_GT_INSTANCES 100
MEAN_PIXEL [123.7 116.8 103.9]
MINI_MASK_SHAPE (56, 56)
NAME coco
NUM_CLASSES 81
POOL_SIZE 7
POST_NMS_ROIS_INFERENCE 1000
POST_NMS_ROIS_TRAINING 2000
ROI_POSITIVE_RATIO 0.33
RPN_ANCHOR_RATIOS [0.5, 1, 2]
RPN_ANCHOR_SCALES (32, 64, 128, 256, 512)
RPN_ANCHOR_STRIDE 1
RPN_BBOX_STD_DEV [0.1 0.1 0.2 0.2]
RPN_NMS_THRESHOLD 0.7
RPN_TRAIN_ANCHORS_PER_IMAGE 256
STEPS_PER_EPOCH 1000
TOP_DOWN_PYRAMID_SIZE 256
TRAIN_BN False
TRAIN_ROIS_PER_IMAGE 200
USE_MINI_MASK True
USE_RPN_ROIS True
VALIDATION_STEPS 50
WEIGHT_DECAY 0.0001

Traceback (most recent call last):
File "/home/wen/anaconda3/lib/python3.6/site-packages/keras/engine/network.py", line 313, in setattr
is_graph_network = self._is_graph_network
File "/home/wen/net_project/MASK/Mask_RCNN-master/mrcnn/parallel_model.py", line 46, in getattribute
return super(ParallelModel, self).getattribute(attrname)
AttributeError: 'ParallelModel' object has no attribute '_is_graph_network'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/wen/net_project/MASK/Mask_RCNN-master/samples/coco/coco.py", line 455, in
model_dir=args.logs)
File "/home/wen/net_project/MASK/Mask_RCNN-master/mrcnn/model.py", line 1848, in init
self.keras_model = self.build(mode=mode, config=config)
File "/home/wen/net_project/MASK/Mask_RCNN-master/mrcnn/model.py", line 2073, in build
model = ParallelModel(model, config.GPU_COUNT)
File "/home/wen/net_project/MASK/Mask_RCNN-master/mrcnn/parallel_model.py", line 35, in init
self.inner_model = keras_model
File "/home/wen/anaconda3/lib/python3.6/site-packages/keras/engine/network.py", line 316, in setattr
'It looks like you are subclassing Model and you '
RuntimeError: It looks like you are subclassing Model and you forgot to call super(YourClass, self).__init__(). Always start with this line.

Process finished with exit code 1

the tensorflow is 1.10. Keras is 2.2.2. when I degrade Keras to 2.1.3, another error occured.

Loading weights /home/wen/net_project/MASK/Mask_RCNN-master/weight/resnet50_coco_v0.1.0.h5
Traceback (most recent call last):
File "/home/wen/net_project/MASK/Mask_RCNN-master/samples/coco/coco.py", line 474, in
model.load_weights(model_path, by_name=True)
File "/home/wen/net_project/MASK/Mask_RCNN-master/mrcnn/model.py", line 2141, in load_weights
saving.load_weights_from_hdf5_group_by_name(f, layers)
File "/home/wen/anaconda3/lib/python3.6/site-packages/keras/engine/topology.py", line 3233, in load_weights_from_hdf5_group_by_name
' element(s).')
ValueError: Layer #2 (named "conv1") expects 2 weight(s), but the saved weights have 1 element(s).


Maybe that the pretrained model dosen't fit the network?

To draw masks on Grayscale image

I want to draw the masks on grayscale image rathar than bgr image which is implemented in ResNet50MaskRCNN.ipynb cell 10 line 3 where the bgr format is converted to rgb and then the masks are drawn on it.
Cell 10 line 3:
draw = image.copy()
draw = cv2.cvtColor(draw, cv2.COLOR_BGR2RGB)
However when I try to convert it into grayscale with
draw = cv2.cvtColor(draw, cv2.COLOR_BGR2GRAY)

It gives me this error:

IndexError: too many indices for array

This is the traceback:


IndexError Traceback (most recent call last)
in ()
40 draw_box(draw, b, color=color)
41 mask = mask[:, :, label]
---> 42 draw_mask(draw, b, mask, color=label_color(label))
43 caption = "{} {:.3f}".format(labels_to_names[label], score)
44 draw_caption(draw, b, caption)

~/keras-maskrcnn-second/keras-maskrcnn/keras_maskrcnn/utils/visualization.py in draw_mask(image, box, mask, label, color, binarize_threshold)
39 # draw the mask
40 indices = np.where(mask != [0, 0, 0])
---> 41 image[indices[0], indices[1], :] = 0.5 * image[indices[0], indices[1], :] + 0.5 * mask[indices[0], indices[1], :]

Instance Segmentation Mode

Hi thank you for all of your help. I have successfully tested the example you provide in the code on my own data and it works REALLY well!

Is there a way to get the output to be instance aware? I think there is I am just wondering if it means modifying the draw_mask function.

from keras_maskrcnn.utils.visualization import draw_mask

How to generate the heatmap of the image?

Hi, I have trained a model by this repository, and i want to generate the heatmap of the features to visual which the importance regions during the feature extracting stage, so is there possible to generate the heatmap ?

TypeError: 'list' object cannot be interpreted as an integer when training on custom dataset

Hi, I have a problem with the training on a custom dataset. I've downloaded the dataset from Data Science Bowl 2018 and generated myself the requiered .csv for training your network.

Example row of my annotations csv : data/stage1train/00071198d059ba7f5914a526d124d28e6d010c92466da21d4a04cd5413362552/images/00071198d059ba7f5914a526d124d28e6d010c92466da21d4a04cd5413362552.png,46,180,64,200,nucleus,data/stage1train/00071198d059ba7f5914a526d124d28e6d010c92466da21d4a04cd5413362552/masks/07a9bf1d7594af2763c86e93f05d22c4d5181353c6d3ab30a345b908ffe5aadc.png

The only row in my classes csv:
nucleus,0

When I try to train your network like this:
%run -i keras_maskrcnn/bin/train.py csv annotations.csv classes.csv
in the notebook it starts of fine with showing me the architecture and loading model stuff, I see Epoch 1/50 and after that an error:

TypeError Traceback (most recent call last)
~\Source\Repos\Mask-RCNN\keras_maskrcnn\bin\train.py in ()
295
296 if name == 'main':
--> 297 main()

~\Source\Repos\Mask-RCNN\keras_maskrcnn\bin\train.py in main(args)
291 verbose=1,
292 callbacks=callbacks,
--> 293 max_queue_size=1,
294 )
295

~\Anaconda3\lib\site-packages\keras\legacy\interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your ' + object_name + 90 ' call to the Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper

~\Anaconda3\lib\site-packages\keras\engine\training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
1413 use_multiprocessing=use_multiprocessing,
1414 shuffle=shuffle,
-> 1415 initial_epoch=initial_epoch)
1416
1417 @interfaces.legacy_generator_methods_support

~\Anaconda3\lib\site-packages\keras\engine\training_generator.py in fit_generator(model, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
175 batch_index = 0
176 while steps_done < steps_per_epoch:
--> 177 generator_output = next(output_generator)
178
179 if not hasattr(generator_output, 'len'):

~\Anaconda3\lib\site-packages\keras\utils\data_utils.py in get(self)
791 success, value = self.queue.get()
792 if not success:
--> 793 six.reraise(value.class, value, value.traceback)

~\Anaconda3\lib\site-packages\six.py in reraise(tp, value, tb)
691 if value.traceback is not tb:
692 raise value.with_traceback(tb)
--> 693 raise value
694 finally:
695 value = None

~\Anaconda3\lib\site-packages\keras\utils\data_utils.py in _data_generator_task(self)
656 # => Serialize calls to
657 # infinite iterator/generator's next() function
--> 658 generator_output = next(self._generator)
659 self.queue.put((True, generator_output))
660 else:

~\Source\Repos\Mask-RCNN\keras_maskrcnn\preprocessing\generator.py in next(self)
259
260 def next(self):
--> 261 return self.next()
262
263 def next(self):

~\Source\Repos\Mask-RCNN\keras_maskrcnn\preprocessing\generator.py in next(self)
270 self.group_index = (self.group_index + 1) % len(self.groups)
271
--> 272 return self.compute_input_output(group)

~\Source\Repos\Mask-RCNN\keras_maskrcnn\preprocessing\generator.py in compute_input_output(self, group)
254
255 # compute network targets
--> 256 targets = self.compute_targets(image_group, annotations_group, masks_group)
257
258 return inputs, targets

~\Source\Repos\Mask-RCNN\keras_maskrcnn\preprocessing\generator.py in compute_targets(self, image_group, annotations_group, masks_group)
217 image_group,
218 annotations_group,
--> 219 self.num_classes()
220 )
221

~\AppData\Roaming\Python\Python36\site-packages\keras_retinanet\utils\anchors.py in anchor_targets_bbox(anchors, annotations, num_classes, mask_shape, negative_overlap, positive_overlap, **kwargs)
46 # anchor states: 1 is positive, 0 is negative, -1 is dont care
47 anchor_states = np.zeros((anchors.shape[0],))
---> 48 labels = np.zeros((anchors.shape[0], num_classes))
49
50 if annotations.shape[0]:

TypeError: 'list' object cannot be interpreted as an integer

I failed to find my error. Any help is appreciated!
(btw running keras 2.2.2)

ResNEt50 Model

Where do we download the trained ResNet50 model from? I can't execute the sample code as a result.

# adjust this to point to your downloaded/trained model
model_path = os.path.join('', 'snapshots', 'resnet50_coco_v0.1.0.h5')

But I don't know where to find this model and I don't see where in the documentation.

How to get mask coordinates in unnormalised form

In the script masks = outputs[-1] gives masks in normalised form. I want to get the coordinates of the mask with respect to image height and width. The sample of the output is:

[[7.16073439e-03 4.37061749e-02]
[6.46292232e-04 1.69230737e-02]
[1.34358503e-04 5.98104158e-03]
[8.63772402e-06 9.09183756e-04]
[1.52459143e-06 1.63313583e-04]
[2.57795051e-07 2.88743213e-05]
[1.29549534e-07 1.26992200e-05]
[8.25274427e-08 7.62913623e-06]
[7.40132506e-08 6.40763710e-06]
[7.66042589e-08 5.65424489e-06]
[8.67134844e-08 4.97382689e-06]
[1.13187959e-07 4.59511102e-06]
[1.53445043e-07 4.22227777e-06]
[3.08056343e-07 4.42291275e-06]
[5.39382484e-07 4.72564534e-06]
[1.31324907e-06 5.01810291e-06]
[2.55442023e-06 5.85846055e-06]
[7.54164967e-06 6.80027006e-06]
[1.86023644e-05 7.52933192e-06]
[7.82388088e-05 8.57268788e-06]
[2.59211636e-04 9.38609355e-06]
[1.88827200e-03 1.56105234e-05]
[1.05140945e-02 3.96420655e-05]
[9.86787602e-02 1.63567151e-04]
[3.92987221e-01 7.62552896e-04]
[7.30162382e-01 3.77393607e-03]
[7.52994001e-01 1.26113920e-02]
[4.81491148e-01 2.60339025e-02]]

How to resume training from saved snapshots

I am able to train the model by using the command
python train.py csv training/annotations.csv training/classes.csv which by default starts from IMage net weights. Now if I want to resume the training from my own weights which is getting saved in the snapshots folder I am confused how should I pass that parameter via command line.

Right now I am using this:

python train.py csv training/annotations.csv training/classes.csv --weights=snapshots/r
esnet50_csv_02.h5

But I am getting this message:

usage: train.py [-h]
[--snapshot SNAPSHOT | --imagenet-weights | --weights WEIGHTS | --no-weights]
[--backbone BACKBONE] [--batch-size BATCH_SIZE] [--gpu GPU]
[--epochs EPOCHS] [--steps STEPS]
[--snapshot-path SNAPSHOT_PATH]
[--tensorboard-dir TENSORBOARD_DIR] [--no-snapshots]
[--no-evaluation] [--freeze-backbone]
[--no-class-specific-filter] [--config CONFIG]
[--weighted-average]
{coco,csv} ...
Can you explain how can I pass mutually exclusive group arguments.Thanks!

Tensor shape error while training starts

I am getting following error while startring the training. I have created my custom dataset in coco format with 1000x1000 training image size.

Total params: 39,333,614
Trainable params: 39,227,374
Non-trainable params: 106,240


None
/home/amjn_cowi/.local/lib/python3.6/site-packages/keras/callbacks.py:1065: UserWarning: epsilon argument is deprecated and will be removed, use min_delta instead.
warnings.warn('epsilon argument is deprecated and '
/anaconda/envs/maskrcnn_retinanet/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py:112: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.
"Converting sparse IndexedSlices to a dense Tensor of unknown shape. "
Epoch 1/50
Traceback (most recent call last):
File "keras_maskrcnn/bin/train.py", line 313, in
main()
File "keras_maskrcnn/bin/train.py", line 309, in main
max_queue_size=1,
File "/home/amjn_cowi/.local/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/home/amjn_cowi/.local/lib/python3.6/site-packages/keras/engine/training.py", line 1418, in fit_generator
initial_epoch=initial_epoch)
File "/home/amjn_cowi/.local/lib/python3.6/site-packages/keras/engine/training_generator.py", line 217, in fit_generator
class_weight=class_weight)
File "/home/amjn_cowi/.local/lib/python3.6/site-packages/keras/engine/training.py", line 1217, in train_on_batch
outputs = self.train_function(ins)
File "/home/amjn_cowi/.local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2715, in call
return self._call(inputs)
File "/home/amjn_cowi/.local/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2675, in _call
fetched = self._callable_fn(*array_vals)
File "/anaconda/envs/maskrcnn_retinanet/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1439, in call
run_metadata_ptr)
File "/anaconda/envs/maskrcnn_retinanet/lib/python3.6/site-packages/tensorflow/python/framework/errors_impl.py", line 528, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 78400 values, but the requested shape requires a multiple of 300
[[{{node masks/Reshape}} = Reshape[T=DT_FLOAT, Tshape=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"](mask_submodel/roi_mask/Sigmoid-2-0-TransposeNCHWToNHWC-LayoutOptimizer, masks/Reshape/shape)]]
[[{{node loss/add_1/_2619}} = _Recvclient_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_12418_loss/add_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]]

Please let me know, what could be the issue.

one mask per image

hi, I have lots of objects in one image is that possible to use only one mask for each image. this way all the objects in the image will have same mask but different bounding boxes, thanks

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.