小编Dio*_*ixo的帖子

Keras flow_from_directory类索引

我曾经手动制作它,但我现在使用flow_from_directory用自己的数据训练我的网络.我只有一个问题.当我制作model.predict()时,我怎么知道我的预测索引0是针对标签类别狗而索引1是针对类别猫?

我正在使用的代码如下.

train_datagen = ImageDataGenerator(
    rescale=1./255,
    shear_range=0.2,
    zoom_range=0.2,
    horizontal_flip=True)

test_datagen = ImageDataGenerator(rescale=1./255)

train_generator = train_datagen.flow_from_directory(
        train_images_path,  
        target_size=(64, 64),  
        batch_size=batch_size)  


validation_generator = test_datagen.flow_from_directory(
        validate_images_path,
        target_size=(64, 64),
        batch_size=batch_size)
early_stopping = keras.callbacks.EarlyStopping(monitor='val_acc', min_delta=0, patience=3, verbose=1, mode='auto')
history = model.fit_generator(
        train_generator,
        steps_per_epoch=1700,
        epochs=epochs,
        verbose=1,
        callbacks=[early_stopping],
        validation_data=validation_generator,
        validation_steps=196
)
Run Code Online (Sandbox Code Playgroud)

我想知道的是配对图像与地面真实标签.

谢谢

keras

9
推荐指数
1
解决办法
8101
查看次数

NextJs 基于正则表达式的重定向

我正在使用 Next.js,并尝试根据一些正则表达式条件和 cookie 重定向到给定路径。

目标是/foo/bar当源没有密钥bar但有给定的 cookie 时进行重定向。

我尝试了几种不同的方法,next.config.js但没有一个有效。

现在我有以下内容

async redirects() {
    return [
      {
        source: '/(^(?:(?!bar).)*$)',
        has: [{
          type: 'cookie',
          key: 'utm_source',
          value: 'bar',

        }],
        destination: '/foo/bar',
        permanent: true
      }
    ]
  }
Run Code Online (Sandbox Code Playgroud)

该文档相当模糊。

reactjs next.js

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

标签 统计

keras ×1

next.js ×1

reactjs ×1