为了增强现实感,很多手机采用双摄摄像头获取视觉深度效果,左右摄像头采集的同一数据,可以使用层嵌入的方式来轻快构建视觉模型:
from keras import layers
from keras import applications
from keras import Input
xception_base = applications.Xception(weights=None,
include_top=False)
left_input = Input(shape=(250, 250, 3))
right_input = Input(shape=(250, 250, 3))
left_features = xception_base(left_input)
right_input = xception_base(right_input)
merged_features = layers.concatenate(
[left_features, right_input], axis=-1)