小编aaa*_*aaa的帖子

Java包级别访问

我知道具有默认访问控制的类成员可以在包级别访问,但我对包级访问实际意味着什么感到困惑.如果可以在包级别访问默认成员,那么在下面的示例中,我不应该在类Test2中看到它吗?1级

package pkg1;
public class Test {
   int i=0;
}
Run Code Online (Sandbox Code Playgroud)

2级

import pkg1.Test;
public class Test2 {

void get(){
    Test t = new Test();
    t.i=0;
}
}
Run Code Online (Sandbox Code Playgroud)

请帮我理解这个概念.提前致谢.

java oop default access-modifiers access-control

4
推荐指数
1
解决办法
4301
查看次数

ValueError: Negative dimension size caused by subtracting 2 from 1 for 'max_pooling2d_6/MaxPool' (op: 'MaxPool') with input shapes: [?,1,1,64]

当我将输入图像的高度和宽度保持在362X362以下时,出现负尺寸大小错误。我很惊讶,因为此错误通常是由于错误的输入尺寸引起的。我没有发现数字或行和列会导致错误的任何原因。以下是我的代码-

batch_size = 32
num_classes = 7
epochs=50
height = 362
width = 362

train_datagen = ImageDataGenerator(
        rotation_range=40,
        width_shift_range=0.2,
        height_shift_range=0.2,
        rescale=1./255,
        shear_range=0.2,
        zoom_range=0.2,
        horizontal_flip=True,
        fill_mode='nearest')

test_datagen = ImageDataGenerator(rescale=1./255)

train_generator = train_datagen.flow_from_directory(
    'train',
        target_size=(height, width),
        batch_size=batch_size,
        class_mode='categorical')

validation_generator = test_datagen.flow_from_directory(
     'validation',
        target_size=(height, width),
        batch_size=batch_size,
        class_mode='categorical')

base_model = InceptionV3(weights='imagenet', include_top=False, input_shape=
(height,width,3))

x = base_model.output
x = Conv2D(32, (3, 3), use_bias=True, activation='relu') (x) #line2
x = MaxPooling2D(pool_size=(2, 2))(x)
x = Conv2D(64, (3, 3), activation='relu') (x) #line3
x = MaxPooling2D(pool_size=(2, 2))(x)
x = …
Run Code Online (Sandbox Code Playgroud)

python neural-network deep-learning conv-neural-network keras

4
推荐指数
3
解决办法
5770
查看次数