uw-biomedical-ml / irf-segmenter Goto Github PK
View Code? Open in Web Editor NEWDeep learning based, intraretinal fluid segmenter for macular OCTs
License: GNU General Public License v3.0
Deep learning based, intraretinal fluid segmenter for macular OCTs
License: GNU General Public License v3.0
Due to the update of the Keras version and API.
I would recommend to set up an environment for the modules needed in the time the repository was created.
I am getting the following error when running the code. Any suggestion is appreciated. The command I use is: python run.py input_file example.png where example.png is the sample png file that was downloaded with the rest of files.
File "run.py", line 140, in
imgori = imgori.reshape((img.shape[1], img.shape[2]))
IndexError: tuple index out of range
Segmentation fault (core dumped)
It would be great is you could provide a command and example that can be tested promptly. I have been trying to figure out how to specify output_file but did not have much luck. Thank you.
Hi, all,
Where could I download dataset about optical coherence (OCT) images of the macula?
Hi, I have a database of this kind. I want to train in the same way(for segmetation). Is there a source you can suggest? Finally, Do you plan to update the application for keras2 or higher versions of tensorflow ?
Thank you.
When I run:
pontikos@neuromancer:~/irf-segmenter$ python run.py example.png example-out.png
I get the following error:
ValueError: Dimension 0 in both shapes must be equal, but are 1 and 3. Shapes are [1] and [3].
From merging shape 0 with other shapes. for 'tower_0/lambda_1/concat/concat_dim' (op: 'Pack') with input shapes: [1], [3].
Full trace:
pontikos@neuromancer:~/irf-segmenter$ python run.py example.png example-out.png
Using TensorFlow backend.
2018-01-05 16:19:17.573040: I tensorflow/core/platform/s3/aws_logging.cc:53] Initializing Curl library
run.py:83: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), padding="same", activation="relu")`
conv1 = Convolution2D(32, 3, 3, activation='relu', border_mode='same')(inputs)
2018-01-05 16:19:18.840005: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1206] Found device 0 with properties:
name: Quadro P6000 major: 6 minor: 1 memoryClockRate(GHz): 1.645
pciBusID: 0000:02:00.0
totalMemory: 23.86GiB freeMemory: 23.20GiB
2018-01-05 16:19:18.840040: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1300] Adding visible gpu device 0
2018-01-05 16:19:19.357810: I tensorflow/core/common_runtime/gpu/gpu_device.cc:987] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 22451 MB memory) -> physical GPU (device: 0, name: Quadro P6000, pci bus id: 0000:02:00.0, compute capability: 6.1)
run.py:84: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), padding="same", activation="relu")`
conv1 = Convolution2D(32, 3, 3, activation='relu', border_mode='same')(conv1)
run.py:87: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), padding="same", activation="relu")`
conv2 = Convolution2D(64, 3, 3, activation='relu', border_mode='same')(pool1)
run.py:88: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), padding="same", activation="relu")`
conv2 = Convolution2D(64, 3, 3, activation='relu', border_mode='same')(conv2)
run.py:91: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), padding="same", activation="relu")`
conv3 = Convolution2D(128, 3, 3, activation='relu', border_mode='same')(pool2)
run.py:92: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), padding="same", activation="relu")`
conv3 = Convolution2D(128, 3, 3, activation='relu', border_mode='same')(conv3)
run.py:95: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), padding="same", activation="relu")`
conv4 = Convolution2D(256, 3, 3, activation='relu', border_mode='same')(pool3)
run.py:96: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), padding="same", activation="relu")`
conv4 = Convolution2D(256, 3, 3, activation='relu', border_mode='same')(conv4)
run.py:99: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(512, (3, 3), padding="same", activation="relu")`
conv5 = Convolution2D(512, 3, 3, activation='relu', border_mode='same')(pool4)
run.py:100: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(512, (3, 3), padding="same", activation="relu")`
conv5 = Convolution2D(512, 3, 3, activation='relu', border_mode='same')(conv5)
run.py:103: UserWarning: The `merge` function is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc.
up6 = merge([UpSampling2D(size=(2, 2))(conv5), conv4], mode='concat', concat_axis=1)
/home/pontikos/.local/lib/python2.7/site-packages/keras/legacy/layers.py:458: UserWarning: The `Merge` layer is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc.
name=name)
run.py:104: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), padding="same", activation="relu")`
conv6 = Convolution2D(256, 3, 3, activation='relu', border_mode='same')(up6)
run.py:105: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), padding="same", activation="relu")`
conv6 = Convolution2D(256, 3, 3, activation='relu', border_mode='same')(conv6)
run.py:107: UserWarning: The `merge` function is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc.
up7 = merge([UpSampling2D(size=(2, 2))(conv6), conv3], mode='concat', concat_axis=1)
run.py:108: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), padding="same", activation="relu")`
conv7 = Convolution2D(128, 3, 3, activation='relu', border_mode='same')(up7)
run.py:109: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), padding="same", activation="relu")`
conv7 = Convolution2D(128, 3, 3, activation='relu', border_mode='same')(conv7)
run.py:111: UserWarning: The `merge` function is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc.
up8 = merge([UpSampling2D(size=(2, 2))(conv7), conv2], mode='concat', concat_axis=1)
run.py:112: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), padding="same", activation="relu")`
conv8 = Convolution2D(64, 3, 3, activation='relu', border_mode='same')(up8)
run.py:113: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), padding="same", activation="relu")`
conv8 = Convolution2D(64, 3, 3, activation='relu', border_mode='same')(conv8)
run.py:115: UserWarning: The `merge` function is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc.
up9 = merge([UpSampling2D(size=(2, 2))(conv8), conv1], mode='concat', concat_axis=1)
run.py:116: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), padding="same", activation="relu")`
conv9 = Convolution2D(32, 3, 3, activation='relu', border_mode='same')(up9)
run.py:117: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), padding="same", activation="relu")`
conv9 = Convolution2D(32, 3, 3, activation='relu', border_mode='same')(conv9)
run.py:119: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(1, (1, 1), activation="sigmoid")`
conv10 = Convolution2D(1, 1, 1, activation='sigmoid')(conv9)
run.py:121: UserWarning: Update your `Model` call to the Keras 2 API: `Model(outputs=Tensor("co..., inputs=Tensor("in...)`
model = Model(input=inputs, output=conv10)
Traceback (most recent call last):
File "run.py", line 126, in <module>
model = make_parallel(model, 1)
File "run.py", line 67, in make_parallel
slice_n = Lambda(get_slice, output_shape=input_shape, arguments={'idx':i,'parts':gpu_count})(x)
File "/home/pontikos/.local/lib/python2.7/site-packages/keras/engine/topology.py", line 603, in __call__
output = self.call(inputs, **kwargs)
File "/home/pontikos/.local/lib/python2.7/site-packages/keras/layers/core.py", line 651, in call
return self.function(inputs, **arguments)
File "run.py", line 51, in get_slice
size = tf.concat(0, [ shape[:1] // parts, shape[1:] ])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1127, in concat
dtype=dtypes.int32).get_shape().assert_is_compatible_with(
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 923, in convert_to_tensor
as_ref=False)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1013, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1001, in _autopacking_conversion_function
return _autopacking_helper(v, inferred_dtype, name or "packed")
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 964, in _autopacking_helper
return gen_array_ops._pack(elems_as_tensors, name=scope)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 2929, in _pack
"Pack", values=values, axis=axis, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3162, in create_op
compute_device=compute_device)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3202, in _create_op_helper
set_shapes_for_outputs(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2427, in set_shapes_for_outputs
return _set_shapes_for_outputs(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2400, in _set_shapes_for_outputs
shapes = shape_func(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2330, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
require_shape_fn)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Dimension 0 in both shapes must be equal, but are 1 and 3. Shapes are [1] and [3].
From merging shape 0 with other shapes. for 'tower_0/lambda_1/concat/concat_dim' (op: 'Pack') with input shapes: [1], [3].
pontikos@neuromancer:~/irf-segmenter$ python run.py example.png example-out.png
Using TensorFlow backend.
2018-01-05 16:24:35.425945: I tensorflow/core/platform/s3/aws_logging.cc:53] Initializing Curl library
run.py:83: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), padding="same", activation="relu")`
conv1 = Convolution2D(32, 3, 3, activation='relu', border_mode='same')(inputs)
2018-01-05 16:24:36.628737: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1206] Found device 0 with properties:
name: Quadro P6000 major: 6 minor: 1 memoryClockRate(GHz): 1.645
pciBusID: 0000:02:00.0
totalMemory: 23.86GiB freeMemory: 880.38MiB
2018-01-05 16:24:36.628765: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1300] Adding visible gpu device 0
2018-01-05 16:24:37.310642: I tensorflow/core/common_runtime/gpu/gpu_device.cc:987] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 535 MB memory) -> physical GPU (device: 0, name: Quadro P6000, pci bus id: 0000:02:00.0, compute capability: 6.1)
run.py:84: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), padding="same", activation="relu")`
conv1 = Convolution2D(32, 3, 3, activation='relu', border_mode='same')(conv1)
run.py:87: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), padding="same", activation="relu")`
conv2 = Convolution2D(64, 3, 3, activation='relu', border_mode='same')(pool1)
run.py:88: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), padding="same", activation="relu")`
conv2 = Convolution2D(64, 3, 3, activation='relu', border_mode='same')(conv2)
run.py:91: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), padding="same", activation="relu")`
conv3 = Convolution2D(128, 3, 3, activation='relu', border_mode='same')(pool2)
run.py:92: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), padding="same", activation="relu")`
conv3 = Convolution2D(128, 3, 3, activation='relu', border_mode='same')(conv3)
run.py:95: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), padding="same", activation="relu")`
conv4 = Convolution2D(256, 3, 3, activation='relu', border_mode='same')(pool3)
run.py:96: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), padding="same", activation="relu")`
conv4 = Convolution2D(256, 3, 3, activation='relu', border_mode='same')(conv4)
run.py:99: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(512, (3, 3), padding="same", activation="relu")`
conv5 = Convolution2D(512, 3, 3, activation='relu', border_mode='same')(pool4)
run.py:100: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(512, (3, 3), padding="same", activation="relu")`
conv5 = Convolution2D(512, 3, 3, activation='relu', border_mode='same')(conv5)
run.py:103: UserWarning: The `merge` function is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc.
up6 = merge([UpSampling2D(size=(2, 2))(conv5), conv4], mode='concat', concat_axis=1)
/home/pontikos/.local/lib/python2.7/site-packages/keras/legacy/layers.py:458: UserWarning: The `Merge` layer is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc.
name=name)
run.py:104: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), padding="same", activation="relu")`
conv6 = Convolution2D(256, 3, 3, activation='relu', border_mode='same')(up6)
run.py:105: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(256, (3, 3), padding="same", activation="relu")`
conv6 = Convolution2D(256, 3, 3, activation='relu', border_mode='same')(conv6)
run.py:107: UserWarning: The `merge` function is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc.
up7 = merge([UpSampling2D(size=(2, 2))(conv6), conv3], mode='concat', concat_axis=1)
run.py:108: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), padding="same", activation="relu")`
conv7 = Convolution2D(128, 3, 3, activation='relu', border_mode='same')(up7)
run.py:109: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(128, (3, 3), padding="same", activation="relu")`
conv7 = Convolution2D(128, 3, 3, activation='relu', border_mode='same')(conv7)
run.py:111: UserWarning: The `merge` function is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc.
up8 = merge([UpSampling2D(size=(2, 2))(conv7), conv2], mode='concat', concat_axis=1)
run.py:112: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), padding="same", activation="relu")`
conv8 = Convolution2D(64, 3, 3, activation='relu', border_mode='same')(up8)
run.py:113: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(64, (3, 3), padding="same", activation="relu")`
conv8 = Convolution2D(64, 3, 3, activation='relu', border_mode='same')(conv8)
run.py:115: UserWarning: The `merge` function is deprecated and will be removed after 08/2017. Use instead layers from `keras.layers.merge`, e.g. `add`, `concatenate`, etc.
up9 = merge([UpSampling2D(size=(2, 2))(conv8), conv1], mode='concat', concat_axis=1)
run.py:116: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), padding="same", activation="relu")`
conv9 = Convolution2D(32, 3, 3, activation='relu', border_mode='same')(up9)
run.py:117: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(32, (3, 3), padding="same", activation="relu")`
conv9 = Convolution2D(32, 3, 3, activation='relu', border_mode='same')(conv9)
run.py:119: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(1, (1, 1), activation="sigmoid")`
conv10 = Convolution2D(1, 1, 1, activation='sigmoid')(conv9)
run.py:121: UserWarning: Update your `Model` call to the Keras 2 API: `Model(outputs=Tensor("co..., inputs=Tensor("in...)`
model = Model(input=inputs, output=conv10)
Traceback (most recent call last):
File "run.py", line 126, in <module>
model = make_parallel(model, 1)
File "run.py", line 67, in make_parallel
slice_n = Lambda(get_slice, output_shape=input_shape, arguments={'idx':i,'parts':gpu_count})(x)
File "/home/pontikos/.local/lib/python2.7/site-packages/keras/engine/topology.py", line 603, in __call__
output = self.call(inputs, **kwargs)
File "/home/pontikos/.local/lib/python2.7/site-packages/keras/layers/core.py", line 651, in call
return self.function(inputs, **arguments)
File "run.py", line 51, in get_slice
size = tf.concat(0, [ shape[:1] // parts, shape[1:] ])
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1127, in concat
dtype=dtypes.int32).get_shape().assert_is_compatible_with(
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 923, in convert_to_tensor
as_ref=False)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1013, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 1001, in _autopacking_conversion_function
return _autopacking_helper(v, inferred_dtype, name or "packed")
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/array_ops.py", line 964, in _autopacking_helper
return gen_array_ops._pack(elems_as_tensors, name=scope)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 2929, in _pack
"Pack", values=values, axis=axis, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3162, in create_op
compute_device=compute_device)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3202, in _create_op_helper
set_shapes_for_outputs(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2427, in set_shapes_for_outputs
return _set_shapes_for_outputs(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2400, in _set_shapes_for_outputs
shapes = shape_func(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2330, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
require_shape_fn)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Dimension 0 in both shapes must be equal, but are 1 and 3. Shapes are [1] and [3].
From merging shape 0 with other shapes. for 'tower_0/lambda_1/concat/concat_dim' (op: 'Pack') with input shapes: [1], [3].
I've got an error when trying to run the example command:
python3.6 run.py example.png output.png
I've got:
ValueError: Dimension 0 in both shapes must be equal, but are 1 and 3 From merging shape 0 with other shapes. for 'tower_0/concat/concat_dim' (op: 'Pack') with input shapes: [1], [3].
from
File "run.py", line 51, in get_slice size = tf.concat(0, [ shape[:1] // parts, shape[1:] ])
Any ideas?
thanks!
asier
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.