Holliemin9090 / Mammographic-mass-CAD-via-pseudo-color-mammogram-and-Mask-R-CNN

Fully automatic computer-aided mass detection and segmentation via pseudo-color mammograms and Mask R-CNN
http://arxiv.org/abs/1906.12118
Other
24 stars 9 forks source link

ValueError: None values not supported when Applying Mask R-CNN #7

Closed Khalifa1997 closed 4 years ago

Khalifa1997 commented 4 years ago

I am running into this issue that I am getting this value error problem when I am using Mask R-CNN to segment some images using the pretained weights from INbreast you had provided TF version: 2.2.0 Keras: 2.4.3 That's the error I am getting.. -even if I have the image tag as the folder containing the images not a specific image-

jupyter@pytorch-20200520-135851:~/Mammographic-mass-CAD-via-pseudo-color-mammogram-and-Mask-R-CNN$ python mamo_CAD.py segment --weights=logs/mask_rcnn_mamogram_weights.h5 --image=20586960_mask.jpg

Configurations:
BACKBONE                       resnet101
BACKBONE_STRIDES               [4, 8, 16, 32, 64]
BATCH_SIZE                     1
BBOX_STD_DEV                   [0.1 0.1 0.2 0.2]
COMPUTE_BACKBONE_SHAPE         None
DETECTION_MAX_INSTANCES        100
DETECTION_MIN_CONFIDENCE       0.965
DETECTION_NMS_THRESHOLD        0.3
FPN_CLASSIF_FC_LAYERS_SIZE     1024
GPU_COUNT                      1
GRADIENT_CLIP_NORM             5.0
IMAGES_PER_GPU                 1
IMAGE_CHANNEL_COUNT            3
IMAGE_MAX_DIM                  1024
IMAGE_META_SIZE                14
IMAGE_MIN_DIM                  1024
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                           mamogram
NUM_CLASSES                    2
POOL_SIZE                      7
POST_NMS_ROIS_INFERENCE        1000
POST_NMS_ROIS_TRAINING         2000
PRE_NMS_LIMIT                  6000
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                100
TOP_DOWN_PYRAMID_SIZE          256
TRAIN_BN                       False
TRAIN_ROIS_PER_IMAGE           200
USE_MINI_MASK                  True
USE_RPN_ROIS                   True
VALIDATION_STEPS               10
WEIGHT_DECAY                   0.0001

2020-07-03 16:53:02.611283: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-07-03 16:53:03.229807: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-07-03 16:53:03.230482: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: 
pciBusID: 0000:00:04.0 name: Tesla T4 computeCapability: 7.5
coreClock: 1.59GHz coreCount: 40 deviceMemorySize: 14.73GiB deviceMemoryBandwidth: 298.08GiB/s
2020-07-03 16:53:03.230838: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2020-07-03 16:53:03.232630: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
2020-07-03 16:53:03.234325: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10
2020-07-03 16:53:03.234713: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10
2020-07-03 16:53:03.236596: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10
2020-07-03 16:53:03.237611: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10
2020-07-03 16:53:03.241696: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-07-03 16:53:03.241868: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-07-03 16:53:03.242617: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-07-03 16:53:03.243195: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2020-07-03 16:53:03.243539: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-07-03 16:53:03.251995: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 2200000000 Hz
2020-07-03 16:53:03.252366: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55b3f83c3220 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-07-03 16:53:03.252406: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-07-03 16:53:03.349058: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-07-03 16:53:03.350014: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x55b3f843d5e0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-07-03 16:53:03.350050: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Tesla T4, Compute Capability 7.5
2020-07-03 16:53:03.350339: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-07-03 16:53:03.351033: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: 
pciBusID: 0000:00:04.0 name: Tesla T4 computeCapability: 7.5
coreClock: 1.59GHz coreCount: 40 deviceMemorySize: 14.73GiB deviceMemoryBandwidth: 298.08GiB/s
2020-07-03 16:53:03.351146: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2020-07-03 16:53:03.351185: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
2020-07-03 16:53:03.351218: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10
2020-07-03 16:53:03.351249: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10
2020-07-03 16:53:03.351278: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10
2020-07-03 16:53:03.351323: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10
2020-07-03 16:53:03.351352: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-07-03 16:53:03.351510: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-07-03 16:53:03.352289: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-07-03 16:53:03.352940: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1703] Adding visible gpu devices: 0
2020-07-03 16:53:03.353031: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2020-07-03 16:53:03.354679: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-07-03 16:53:03.354704: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108]      0 
2020-07-03 16:53:03.354712: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0:   N 
2020-07-03 16:53:03.354913: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-07-03 16:53:03.355645: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-07-03 16:53:03.356286: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1247] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 14071 MB memory) -> physical GPU (device: 0, name: Tesla T4, pci bus id: 0000:00:04.0, compute capability: 7.5)
Traceback (most recent call last):
  File "mamo_CAD.py", line 306, in <module>
    model_dir=DEFAULT_LOGS_DIR)
  File "/home/jupyter/Mammographic-mass-CAD-via-pseudo-color-mammogram-and-Mask-R-CNN/Mask_r_cnn/mrcnn/model.py", line 1837, in __init__
    self.keras_model = self.build(mode=mode, config=config)
  File "/home/jupyter/Mammographic-mass-CAD-via-pseudo-color-mammogram-and-Mask-R-CNN/Mask_r_cnn/mrcnn/model.py", line 2044, in build
    [rpn_rois, mrcnn_class, mrcnn_bbox, input_image_meta])
  File "/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py", line 922, in __call__
    outputs = call_fn(cast_inputs, *args, **kwargs)
  File "/opt/conda/lib/python3.7/site-packages/tensorflow/python/autograph/impl/api.py", line 265, in wrapper
    raise e.ag_error_metadata.to_exception(e)
ValueError: in user code:

    /home/jupyter/Mammographic-mass-CAD-via-pseudo-color-mammogram-and-Mask-R-CNN/Mask_r_cnn/mrcnn/model.py:810 call  *
        detections_batch = utils.batch_slice(
    /home/jupyter/Mammographic-mass-CAD-via-pseudo-color-mammogram-and-Mask-R-CNN/Mask_r_cnn/mrcnn/utils.py:820 batch_slice  *
        output_slice = graph_fn(*inputs_slice)
    /tmp/tmpf4ajij6e.py:17 None  *
        detections_batch = ag__.converted_call(utils.batch_slice, ([rois, mrcnn_class, mrcnn_bbox, window], (lambda x, y, w, z: ag__.converted_call(refine_detections_graph, (x, y, w, z, self.config), None, fscope)), self.config.IMAGES_PER_GPU), None, fscope)
    /home/jupyter/Mammographic-mass-CAD-via-pseudo-color-mammogram-and-Mask-R-CNN/Mask_r_cnn/mrcnn/model.py:702 refine_detections_graph  *
        indices = tf.stack([tf.range(probs.shape[0]), class_ids], axis=1)
    /opt/conda/lib/python3.7/site-packages/tensorflow/python/ops/math_ops.py:1571 range  **
        limit = ops.convert_to_tensor(limit, dtype=dtype, name="limit")
    /opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/ops.py:1341 convert_to_tensor
        ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
    /opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:321 _constant_tensor_conversion_function
        return constant(v, dtype=dtype, name=name)
    /opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:262 constant
        allow_broadcast=True)
    /opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py:300 _constant_impl
        allow_broadcast=allow_broadcast))
    /opt/conda/lib/python3.7/site-packages/tensorflow/python/framework/tensor_util.py:439 make_tensor_proto
        raise ValueError("None values not supported.")

    ValueError: None values not supported.

Also, I have migrated Pseudo_color_image_generation.m to python code using numpy and pywt for wavelets, and it's very close to your implementation, I will be making a Pull request soon to add it to your repo :)

Khalifa1997 commented 4 years ago

Nevermind, I had to downgrade both my Python version and tf.. Thanks tho