def __init__(self, num_classes=60): super().__init__() graph = Graph() self.A = tf.Variable(graph.A, dtype=tf.float32, trainable=False, name='adjacency_matrix') self.data_bn = tf.keras.layers.BatchNormalization(axis=1) self.STGCN_layers = [] self.STGCN_layers.append(SpatioTemporalGraphConv(64, residual=False)) self.STGCN_layers.append(SpatioTemporalGraphConv(64)) self.STGCN_layers.append(SpatioTemporalGraphConv(64)) self.STGCN_layers.append(SpatioTemporalGraphConv(64)) self.STGCN_layers.append(SpatioTemporalGraphConv(128, stride=2)) self.STGCN_layers.append(SpatioTemporalGraphConv(128)) self.STGCN_layers.append(SpatioTemporalGraphConv(128)) self.STGCN_layers.append(SpatioTemporalGraphConv(256, stride=2)) self.STGCN_layers.append(SpatioTemporalGraphConv(256)) self.STGCN_layers.append(SpatioTemporalGraphConv(256)) self.pool = tf.keras.layers.GlobalAveragePooling2D( data_format='channels_first') self.logits = tf.keras.layers.Conv2D(num_classes, kernel_size=1, padding='same', kernel_initializer=INITIALIZER, kernel_regularizer=REGULARIZER, data_format='channels_first')
def __init__(self, num_classes=60): super().__init__() graph = Graph() A = graph.A.astype(np.float32) self.data_bn = tf.keras.layers.BatchNormalization(axis=1) self.STGCN_layers = [] self.STGCN_layers.append(STGCN(64, A, 300, residual=False)) self.STGCN_layers.append(STGCN(64, A, 300)) self.STGCN_layers.append(STGCN(64, A, 300)) self.STGCN_layers.append(STGCN(64, A, 300)) self.STGCN_layers.append(STGCN(128, A, 300, stride=2, downsample=True)) self.STGCN_layers.append(STGCN(128, A, 150)) self.STGCN_layers.append(STGCN(128, A, 150)) self.STGCN_layers.append(STGCN(256, A, 150, stride=2, downsample=True)) self.STGCN_layers.append(STGCN(256, A, 75)) self.STGCN_layers.append(STGCN(256, A, 75)) self.pool = tf.keras.layers.GlobalAveragePooling2D( data_format='channels_first') self.logits = tf.keras.layers.Conv2D(num_classes, kernel_size=1, padding='same', kernel_initializer=INITIALIZER, data_format='channels_first', kernel_regularizer=REGULARIZER)
def __init__(self, num_classes=60): super().__init__() self.graph = Graph() A = self.graph.A.astype(np.float32) self.data_bn = tf.keras.layers.BatchNormalization(axis=1) self.GTC_layers = [] self.GTC_layers.append(GraphTemporalConv(64, A, down=False, residual=False)) self.GTC_layers.append(GraphTemporalConv(64, A)) self.GTC_layers.append(GraphTemporalConv(64, A)) self.GTC_layers.append(GraphTemporalConv(64, A)) self.GTC_layers.append(GraphTemporalConv(128, A, down=True, stride=2)) self.GTC_layers.append(GraphTemporalConv(128, A)) self.GTC_layers.append(GraphTemporalConv(128, A)) self.GTC_layers.append(GraphTemporalConv(256, A, down=True, stride=2)) self.GTC_layers.append(GraphTemporalConv(256, A)) self.GTC_layers.append(GraphTemporalConv(256, A)) self.fc = tf.keras.layers.Dense(num_classes, kernel_initializer=INITIALIZER, kernel_regularizer=REGULARIZER)