小编anw*_*war的帖子

Tensorflow Keras 错误:未知的图像文件格式。需要 JPEG、PNG、GIF、BMP 之一

我正在训练一个分类器,并确保所有图片都是 jpg,但仍然出现此错误:InvalidArgumentError:未知的图像文件格式。需要 JPEG、PNG、GIF、BMP 之一。[[{{节点decode_image/DecodeImage}}]] [[IteratorGetNext]] [Op:__inference_train_function_1481]

我尝试在较小的数据集上进行训练,而且它们都是 jpg,没有问题

这是代码:

import numpy as np
import tensorflow as tf
from tensorflow import keras

dataset = keras.preprocessing.image_dataset_from_directory(
  '/content/drive/MyDrive/fi_dataset/train', batch_size=64, image_size=(200, 200))

dense = keras.layers.Dense(units=16)
inputs = keras.Input(shape=(None, None, 3))

from tensorflow.keras import layers

x = CenterCrop(height=150, width=150)(inputs)
x = Rescaling(scale=1.0 / 255)(x)

x = layers.Conv2D(filters=32, kernel_size=(3, 3), activation="relu")(x)
x = layers.MaxPooling2D(pool_size=(3, 3))(x)
x = layers.Conv2D(filters=32, kernel_size=(3, 3), activation="relu")(x)
x = layers.MaxPooling2D(pool_size=(3, 3))(x)
x = layers.Conv2D(filters=32, kernel_size=(3, 3), activation="relu")(x)

x = layers.GlobalAveragePooling2D()(x)

num_classes = …
Run Code Online (Sandbox Code Playgroud)

python image keras tensorflow google-colaboratory

8
推荐指数
2
解决办法
1万
查看次数

如何在flutter中设置showModalBottomSheet宽度

我有设计(如图所示)并且正在使用 showModalBottomSheet 但是当我设置宽度时,它不会改变并保持屏幕宽度,所以我有几个问题:

1-如何设置 showModalBottomSheet 的宽度
2-对于这种底部菜单,是否有 showModalBottomSheet 的替代方案
3-如何模糊照片中显示的背景

showModalBottomSheet<void>(
          context: context,
          builder: (BuildContext context) {
            return Container(
              height: SizeConfig.screenHeight * 0.6,
              width: 30,
              color: Colors.red,
              child: Center(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    const Text('Modal BottomSheet'),
                    ElevatedButton(
                      child: const Text('Close BottomSheet'),
                      onPressed: () => Navigator.pop(context),
                    )
                  ],
                ),
              ),
            );
          },
        );
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

menu widget button flutter flutter-layout

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

更新到 Spyder 4.1 后出现内核错误

我通过 (conda update spyder) 在 anaconda 中将 spyder 更新到 4.1,除非我从 anaconda 提示符打开它,否则它不起作用,否则会显示此错误:

启动内核时发生错误 错误是:

回溯(最近一次调用最后一次):

文件“C:\Users\anwar\Anaconda3\lib\site?packages\spyder\plugins\ipythonconsole\plugin.py”,第 1209 行,在 create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle, **kwargs)

文件“C:\Users\anwar\Anaconda3\lib\site?packages\jupyter_client\manager.py”,第 267 行,在 start_kernel
self.kernel = self._launch_kernel(kernel_cmd, env=env, **kw)

文件“C:\Users\anwar\Anaconda3\lib\site?packages\jupyter_client\manager.py”,第 211 行,在 _launch_kernel 中
return launch_kernel(kernel_cmd, **kw)

文件“C:\Users\anwar\Anaconda3\lib\site?packages\jupyter_client\launcher.py”,第 135 行,launch_kernel
proc = Popen (cmd, **kwargs)

文件“C:\Users\anwar\Anaconda3\lib\ subprocess.py ”,第 775 行,在init restore_signals、start_new_session 中)

文件“C:\Users\anwar\Anaconda3\lib\subprocess.py”,第 1178 行,在 _execute_child startupinfo 中)

FileNotFoundError: [WinError 2] 系统找不到指定的文件

在角落里,它仍然显示 spyder 3.7

python spyder anaconda

2
推荐指数
1
解决办法
1164
查看次数