Open eddienko opened 4 years ago
What doesn't work for you exactly?
Sorry, my bad, it does work as written. I have an extra line in the code:
import segmentation_models as sm
sm.set_framework('tf.keras')
In this case the code in the docs produce the following error message:
...
AttributeError Traceback (most recent call last)
<ipython-input-6-e0b3e3f58b6b> in <module>
3 inp = Input(shape=(None, None, N))
4 l1 = Conv2D(3, (1, 1))(inp) # map N channels data to 3 channels
----> 5 out = base_model(l1)
6
7 model = Model(inp, out, name=base_model.name)
...
/opt/conda/lib/python3.7/site-packages/tensorflow/python/keras/engine/base_layer.py in <lambda>(t)
2327 `call` method of the layer at the call that created the node.
2328 """
-> 2329 inbound_layers = nest.map_structure(lambda t: t._keras_history.layer,
2330 input_tensors)
2331 node_indices = nest.map_structure(lambda t: t._keras_history.node_index,
AttributeError: 'tuple' object has no attribute 'layer'
You can also artificially create a 3D image from your 2D image with
ìmage_3d = np.array([image, image, image])
I am trining the network with gray scale images and I found an issue (I believe) with the documentation. The docs say:
This does not work for me when using the tensorflow backend. Instead I need to do: