我正在进行图像分类。首先,我将我的图像提供给我在Keras的CNN模型。
我想在keras的Flatten图层输出中添加新功能,然后将其提供给密集图层。我该如何为它编写代码?
基本上我使用Convolution进行图像处理,最后我想添加其他功能,如Age Sex等。
2018-01-26 07:52:28,563][INFO ][exchange-worker-#42][time] Started exchange init [topVer=AffinityTopologyVersion [topVer=29, minorTopVer=0], crd=true, evt=NODE_JOINED, evtNode=649c5360-7060-40cf-9454-ad6d08be2a7c, customEvt=null, allowMerge=true]
[2018-01-26 07:52:28,563][INFO ][exchange-worker-#42][GridDhtPartitionsExchangeFuture] Finish exchange future [startVer=AffinityTopologyVersion [topVer=29, minorTopVer=0], resVer=AffinityTopologyVersion [topVer=29, minorTopVer=0], err=null]
[2018-01-26 07:52:28,564][INFO ][exchange-worker-#42][time] Finished exchange init [topVer=AffinityTopologyVersion [topVer=29, minorTopVer=0], crd=true]
[2018-01-26 07:52:28,564][INFO ][exchange-worker-#42][GridCachePartitionExchangeManager] Skipping rebalancing (nothing scheduled) [top=AffinityTopologyVersion [topVer=29, minorTopVer=0], evt=NODE_JOINED, node=649c5360-7060-40cf-9454-ad6d08be2a7c]
[2018-01-26 07:52:29,963][INFO ][grid-nio-worker-tcp-comm-0-#25][TcpCommunicationSpi] Accepted incoming communication connection [locAddr=/10.0.0.3:47100, rmtAddr=/183.82.140.186:31996]
**[2018-01-26 07:52:41,461][ERROR][tcp-disco-msg-worker-#3][TcpDiscoverySpi] Failed to unmarshal discovery custom message.
class org.apache.ignite.IgniteCheckedException: Failed to find class with given class loader for unmarshalling (make sure same versions of all classes are available on all nodes or enable peer-class-loading) [clsLdr=sun.misc.Launcher$AppClassLoader@764c12b6,**
在将平板作为输入到密集层之前,我想添加一些功能来平放。我该怎么做?
感谢您的帮助!
答案 0 :(得分:6)
您只需使用Concatenate图层将这些要素附加到具有新输入图层的展平向量:
otherInp = Input(shape = (n_features, ))
concatenatedFeatures = Concatenate(axis = 1)([flat, otherInp])
dense = Dense(128)(concatenatedFeatures)