當前位置: 首頁>>代碼示例>>Python>>正文


Python conv_utils.conv_output_length方法代碼示例

本文整理匯總了Python中keras.utils.conv_utils.conv_output_length方法的典型用法代碼示例。如果您正苦於以下問題:Python conv_utils.conv_output_length方法的具體用法?Python conv_utils.conv_output_length怎麽用?Python conv_utils.conv_output_length使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在keras.utils.conv_utils的用法示例。


在下文中一共展示了conv_utils.conv_output_length方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        if self.data_format == 'channels_first':
            rows = input_shape[2]
            cols = input_shape[3]
        elif self.data_format == 'channels_last':
            rows = input_shape[1]
            cols = input_shape[2]

        rows = conv_utils.conv_output_length(rows, self.kernel_size[0],
                                             self.padding,
                                             self.strides[0])
        cols = conv_utils.conv_output_length(cols, self.kernel_size[1],
                                             self.padding,
                                             self.strides[1])
        if self.data_format == 'channels_first':
            return (input_shape[0], self.filters, rows, cols)
        elif self.data_format == 'channels_last':
            return (input_shape[0], rows, cols, self.filters) 
開發者ID:rcmalli,項目名稱:keras-mobilenet,代碼行數:20,代碼來源:depthwise_conv2d.py

示例2: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        if self.data_format == 'channels_first':
            rows = input_shape[2]
            cols = input_shape[3]
            out_filters = input_shape[1] * self.depth_multiplier
        elif self.data_format == 'channels_last':
            rows = input_shape[1]
            cols = input_shape[2]
            out_filters = input_shape[3] * self.depth_multiplier

        rows = conv_utils.conv_output_length(rows, self.kernel_size[0],
                                             self.padding,
                                             self.strides[0])
        cols = conv_utils.conv_output_length(cols, self.kernel_size[1],
                                             self.padding,
                                             self.strides[1])

        if self.data_format == 'channels_first':
            return (input_shape[0], out_filters, rows, cols)
        elif self.data_format == 'channels_last':
            return (input_shape[0], rows, cols, out_filters) 
開發者ID:killthekitten,項目名稱:kaggle-carvana-2017,代碼行數:23,代碼來源:mobile_net_fixed.py

示例3: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        if self.data_format == 'channels_first':
            rows = input_shape[2]
            cols = input_shape[3]
            out_filters = input_shape[1] * self.depth_multiplier
        elif self.data_format == 'channels_last':
            rows = input_shape[1]
            cols = input_shape[2]
            out_filters = input_shape[3] * self.depth_multiplier

        rows = conv_utils.conv_output_length(rows, self.kernel_size[0],
                                             self.padding, self.strides[0])
        cols = conv_utils.conv_output_length(cols, self.kernel_size[1],
                                             self.padding, self.strides[1])

        if self.data_format == 'channels_first':
            return (input_shape[0], out_filters, rows, cols)
        elif self.data_format == 'channels_last':
            return (input_shape[0], rows, cols, out_filters) 
開發者ID:junhwanjang,項目名稱:face_landmark_dnn,代碼行數:21,代碼來源:train_mobilenets.py

示例4: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        if self.data_format == 'channels_first':
            rows = input_shape[2]
            cols = input_shape[3]
            out_filters = input_shape[1] * self.depth_multiplier
        elif self.data_format == 'channels_last':
            rows = input_shape[1]
            cols = input_shape[2]
            out_filters = input_shape[3] * self.depth_multiplier

        rows = conv_utils.conv_output_length(rows, self.kernel_size[0],
                                             self.padding,
                                             self.strides[0])
        cols = conv_utils.conv_output_length(cols, self.kernel_size[1],
                                             self.padding,
                                             self.strides[1])

        if self.data_format == 'channels_first':
            return input_shape[0], out_filters, rows, cols
        elif self.data_format == 'channels_last':
            return input_shape[0], rows, cols, out_filters 
開發者ID:titu1994,項目名稱:keras-squeeze-excite-network,代碼行數:23,代碼來源:se_mobilenets.py

示例5: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        if self.data_format == 'channels_last':
            space = input_shape[1:-1]
            new_space = []
            for i in range(len(space)):
                new_dim = conv_utils.conv_output_length(
                    space[i],
                    self.kernel_size[i],
                    padding=self.padding,
                    stride=self.strides[i],
                    dilation=self.dilation_rate[i])
                new_space.append(new_dim)
            return (input_shape[0],) + tuple(new_space) + (self.filters,)
        if self.data_format == 'channels_first':
            space = input_shape[2:]
            new_space = []
            for i in range(len(space)):
                new_dim = conv_utils.conv_output_length(
                    space[i],
                    self.kernel_size[i],
                    padding=self.padding,
                    stride=self.strides[i],
                    dilation=self.dilation_rate[i])
                new_space.append(new_dim)
            return (input_shape[0], self.filters) + tuple(new_space) 
開發者ID:emilwallner,項目名稱:Coloring-greyscale-images,代碼行數:27,代碼來源:sn.py

示例6: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        if self.data_format == 'channels_last':
            space = input_shape[1:-1]
            new_space = []
            for i in range(len(space)):
                new_dim = conv_utils.conv_output_length(
                    space[i],
                    self.kernel_size[i],
                    padding=self.padding,
                    stride=self.strides[i],
                    dilation=self.dilation_rate[i])
                new_space.append(new_dim)
            return (input_shape[0],) + tuple(new_space) + (self.n_filters,)
        if self.data_format == 'channels_first':
            space = input_shape[2:]
            new_space = []
            for i in range(len(space)):
                new_dim = conv_utils.conv_output_length(
                    space[i],
                    self.kernel_size[i],
                    padding=self.padding,
                    stride=self.strides[i],
                    dilation=self.dilation_rate[i])
                new_space.append(new_dim)
            return (input_shape[0], self.n_filters) + tuple(new_space) 
開發者ID:eminorhan,項目名稱:mixture-of-experts,代碼行數:27,代碼來源:ConvolutionalMoE.py

示例7: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        space = input_shape[1:-1]
        new_space = []
        for i in range(len(space)):
            new_dim = conv_utils.conv_output_length(
                space[i],
                filter_size=1,
                padding=self.padding,
                stride=self.strides[i],
                dilation=self.dilation_rate[i])
            new_space.append(new_dim)
        return (input_shape[0],) + tuple(new_space) + (self.filters,) 
開發者ID:titu1994,項目名稱:keras_mixnets,代碼行數:14,代碼來源:custom_objects.py

示例8: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        space = input_shape[1:-1]
        new_space = []
        for i in range(len(space)):
            new_dim = conv_utils.conv_output_length(
                space[i],
                self.kernel_size[i],
                padding=self.padding,
                stride=self.strides[i])
            new_space.append(new_dim)

        return (None, np.prod(new_space) * self.filters, self.dim_capsule) 
開發者ID:l11x0m7,項目名稱:CapsNet,代碼行數:14,代碼來源:capsule.py

示例9: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        if self.data_format == 'channels_last':
            space = input_shape[1:-1]
            new_space = []
            for i in range(len(space)):
                new_dim = conv_utils.conv_output_length(
                    space[i],
                    self.kernel_size[i],
                    padding=self.padding,
                    stride=self.strides[i],
                    dilation=self.dilation_rate[i]
                )
                new_space.append(new_dim)
            return (input_shape[0],) + tuple(new_space) + (2 * self.filters,)
        if self.data_format == 'channels_first':
            space = input_shape[2:]
            new_space = []
            for i in range(len(space)):
                new_dim = conv_utils.conv_output_length(
                    space[i],
                    self.kernel_size[i],
                    padding=self.padding,
                    stride=self.strides[i],
                    dilation=self.dilation_rate[i])
                new_space.append(new_dim)
            return (input_shape[0],) + (2 * self.filters,) + tuple(new_space) 
開發者ID:ChihebTrabelsi,項目名稱:deep_complex_networks,代碼行數:28,代碼來源:conv.py

示例10: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        if self.data_format == 'channels_last':
            space = input_shape[1:-1]
            new_space = []
            for i in range(len(space)):
                new_dim = conv_utils.conv_output_length(
                    space[i],
                    self.kernel_size[i],
                    padding=self.padding,
                    stride=self.strides[i],
                    dilation=self.dilation_rate[i]
                )
                new_space.append(new_dim)
            return (input_shape[0],) + tuple(new_space) + (4 * self.filters,)
        if self.data_format == 'channels_first':
            space = input_shape[2:]
            new_space = []
            for i in range(len(space)):
                new_dim = conv_utils.conv_output_length(
                    space[i],
                    self.kernel_size[i],
                    padding=self.padding,
                    stride=self.strides[i],
                    dilation=self.dilation_rate[i])
                new_space.append(new_dim)
            return (input_shape[0],) + (4 * self.filters,) + tuple(new_space) 
開發者ID:Orkis-Research,項目名稱:Quaternion-Convolutional-Neural-Networks-for-End-to-End-Automatic-Speech-Recognition,代碼行數:28,代碼來源:conv.py

示例11: compute_output_shape

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def compute_output_shape(self, input_shape):
        if isinstance(input_shape, list):
            input_shape = input_shape[0]

        length = input_shape[1]
        if length:
            length = conv_output_length(length + self.window_size - 1,
                                        self.window_size, 'valid',
                                        self.strides[0])
        if self.return_sequences:
            return (input_shape[0], length, self.units)
        else:
            return (input_shape[0], self.units) 
開發者ID:amansrivastava17,項目名稱:embedding-as-service,代碼行數:15,代碼來源:qrnn.py

示例12: test_conv_output_length

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def test_conv_output_length():
    assert conv_utils.conv_output_length(None, 7, 'same', 1) is None
    assert conv_utils.conv_output_length(224, 7, 'same', 1) == 224
    assert conv_utils.conv_output_length(224, 7, 'same', 2) == 112
    assert conv_utils.conv_output_length(32, 5, 'valid', 1) == 28
    assert conv_utils.conv_output_length(32, 5, 'valid', 2) == 14
    assert conv_utils.conv_output_length(32, 5, 'causal', 1) == 32
    assert conv_utils.conv_output_length(32, 5, 'causal', 2) == 16
    assert conv_utils.conv_output_length(32, 5, 'full', 1) == 36
    assert conv_utils.conv_output_length(32, 5, 'full', 2) == 18

    with pytest.raises(AssertionError):
        conv_utils.conv_output_length(32, 5, 'diagonal', 2) 
開發者ID:hello-sea,項目名稱:DeepLearning_Wavelet-LSTM,代碼行數:15,代碼來源:conv_utils_test.py

示例13: test_conv_input_length

# 需要導入模塊: from keras.utils import conv_utils [as 別名]
# 或者: from keras.utils.conv_utils import conv_output_length [as 別名]
def test_conv_input_length():
    assert conv_utils.conv_input_length(None, 7, 'same', 1) is None
    assert conv_utils.conv_input_length(112, 7, 'same', 1) == 112
    assert conv_utils.conv_input_length(112, 7, 'same', 2) == 223
    assert conv_utils.conv_input_length(28, 5, 'valid', 1) == 32
    assert conv_utils.conv_input_length(14, 5, 'valid', 2) == 31
    assert conv_utils.conv_input_length(36, 5, 'full', 1) == 32
    assert conv_utils.conv_input_length(18, 5, 'full', 2) == 31

    with pytest.raises(AssertionError):
        conv_utils.conv_output_length(18, 5, 'diagonal', 2) 
開發者ID:hello-sea,項目名稱:DeepLearning_Wavelet-LSTM,代碼行數:13,代碼來源:conv_utils_test.py


注:本文中的keras.utils.conv_utils.conv_output_length方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。