首页 \ 问答 \ ImageDataGenerator没有定义(ImageDataGenerator is not defined)

ImageDataGenerator没有定义(ImageDataGenerator is not defined)

我是Keras和DL的新手。 我从keras文档中获得这些代码。 想在我的系统上运行它。

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('C:\\Users\\kashy\\Desktop\\Data\\train',target_size=(200,200),batch_size=batch_size,class_mode='binary')

 validation_generator = test_datagen.flow_from_directory('C:\\Users\\kashy\\Desktop\\Data\\validation',target_size=(200,200),batch_size=batch_size,class_mode='binary')

这是我正在处理的代码片段..

当我试图在我的系统上运行这个...我得到以下错误

Traceback (most recent call last):
 File "C:\Users\kashy\Desktop\trial1.py", line 29, in <module>
train_datagen = ImageDataGenerator(
NameError: name 'ImageDataGenerator' is not defined

有人可以帮助我吗?

谢谢 !!!


I am new to Keras and DL. I got this code from a keras document. wanted to run it on my system.

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('C:\\Users\\kashy\\Desktop\\Data\\train',target_size=(200,200),batch_size=batch_size,class_mode='binary')

 validation_generator = test_datagen.flow_from_directory('C:\\Users\\kashy\\Desktop\\Data\\validation',target_size=(200,200),batch_size=batch_size,class_mode='binary')

this is snippet of the code i was working on..

when i tried to run this on my system... i got the following error

Traceback (most recent call last):
 File "C:\Users\kashy\Desktop\trial1.py", line 29, in <module>
train_datagen = ImageDataGenerator(
NameError: name 'ImageDataGenerator' is not defined

can somebody help me ??

thanks !!!


原文:https://stackoverflow.com/questions/48036485
更新时间:2022-08-08 18:08

最满意答案

我假设你正在使用AuthBot (通过查看代码)。

你需要添加的是以下内容:

 await base.MessageReceived(context, item);

这只会将消息传递给LUISDialog的MessageReceived实现; 这将向LUIS发出查询以了解应该执行哪个意图。


I assume that you are using AuthBot (by looking at the code).

What you need to add is the following:

 await base.MessageReceived(context, item);

That will just pass the message to LUISDialog's MessageReceived implementation; which will issue a query to LUIS to understand which intent should be executed.

相关问答

更多
  • 您只需在表单模型中设置值,在您的情况下为TestRequest 。 所以不要这样做: IDialog testForm = new FormDialog(new TestRequest(), this.MakeTestForm, FormOptions.PromptInStart, entities); 你可以做 IDialog testForm = new FormDialog(new TestReq ...
  • 正如您注意到的那样,您的实施有两个问题: 当前“不自动”的CarouselCards对话框的开始 这个对话结束,因为它不断地显示卡片 问题1 - 启动传送对话框 对于第一个问题,它来自您将用户发送到对话框的方式: [LuisIntent("Help")] public async Task Help(IDialogContext context, LuisResult result) { context.Call(new CarouselCardsDialog(), DialogsCompleted ...
  • 我假设你正在使用AuthBot (通过查看代码)。 你需要添加的是以下内容: await base.MessageReceived(context, item); 这只会将消息传递给LUISDialog的MessageReceived实现; 这将向LUIS发出查询以了解应该执行哪个意图。 I assume that you are using AuthBot (by looking at the code). What you need to add is the following: await b ...
  • LUIS的密钥用法有几个配额: 免费密钥: 5次/秒 每月10 000个电话 标准钥匙: 50次/秒 请参阅下面的Azure门户网站截图,其中5秒可见免费计划: 并链接到LUIS定价 There are several quotas on LUIS's keys usage: Free key: 5 calls / second 10 000 calls / month Standard key: 50 calls / second See Azure portal's capture below wher ...
  • 要添加密钥,请点击您的帐户设置(右上角,或转到https://www.luis.ai/Home/UserSettings )。 在我的设置 - >订阅密钥下,您可以向用户添加新密钥。 只需注意 - 您无需输入密钥即可创建应用程序。 密钥可让您拥有到端点的无限流量。 如果你刚刚开始,这是不必要的。 (见https://www.luis.ai/Help ) In order to add a key, click your account setting (top right corner, or go to ...
  • 这个问题的解决方案取决于你的模型。 因为LUIS与一个话语相关联的意图和分数可能受到任何实体或任何意图上添加的任何话语的影响。 您可以尝试: - 查看与“consumo”关联的错误意图,并且如果某些话语与“consumo”相似,则可能两个意图应该是相同的 - 在列表中创建具有“consumo”和其他实体的列表实体 The solution to this problems depends on your model. Because the intent that LUIS associates to on ...
  • LUIS中有500个字符的限制(来源: https : //www.luis.ai/Help )。 您可以通过发送电子邮件(如主题)或在发送到LUIS之前将其用于最常见的单词进行擦除来解决问题。 (我不知道你的第二个问题的答案,抱歉。我发布这个评论但我的代表太低了。你能在模拟器中运行你的机器人来获得某种错误吗?) There's a 500 character limit in LUIS (source: https://www.luis.ai/Help). You could work around it ...
  • 我认为问题是你发送一个string ( result.Query ),而QnAMakerDialog.cs期待一个IMessageActivity 。 尝试更新您的context.Forward调用: var msg = context.MakeMessage(); msg.Text = result.Query; await context.Forward(new QnABot(), Whatever, msg, CancellationToken.None); 或者,您可以更新None intent ...
  • 您需要使用context.Call或context.Forward来调用子对话框。 context.Call(SimpleFacebookAuthDialog.dialog, this.ResumeAfterAuth); 您可能需要检查MultiDialogs示例以掌握所涉及的一些概念。 You need to use context.Call or context.Forward in order to call a child dialog. context.Call(SimpleFacebookAu ...
  • 像你一样扩展控制器并在控制台配置中添加: 'controllerMap' => [ 'message' => 'app\commands\MessageController', ], Extend the controller like you did and in console configuration add: 'controllerMap' => [ 'message' => 'app\commands\MessageController', ],

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)