이 과정은 다음과 같이 진행됩니다 x(batch, time, w, h, c)
=> Reshape
=> (batch*time, w, h, c)
=> Conv2D => 모양 변경 => (batch,time, w, h, c')
=> ConvLstm2d => ...
(가) tf.keras.layers.Reshape
단지 내가 추출 할 수 없습니다 비 BATCH_SIZE 부분 바꿀 수 있습니다 time
이전 고쳐 크기에서를 (batch*time,w,h,c)
.
이와 같은 모델을 달성하는 적절한 방법이 있습니까?
맞아요, tf.keras
배치 차원 재 형성을 지원하지 않습니다-그렇게 할 레이어가 필요하고 여전히 tf.keras
사용자 정의 레이어 작성으로 작업하는 경우
class BatchAwareReshape(tf.keras.layers.Layer):
def __init__(self, shape, **kwargs):
super().__init__(**kwargs)
self._shape = shape
def call(self, inputs):
return tf.reshape(inputs, self._shape)
이후 tf.reshape
일괄 차원의 인식, 이제 레이어를 호출 할 수있는 BatchAwareReshape(shape=(batch*time, w, h, c))
모델 내부 그것은 작동합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다