keras

keras prediction output's decimal point without scientifc notation?

感情迁移 提交于 2021-01-05 09:19:31
问题 Through Keras, I have a question while studying at CNN. How do I output the results from the predictive calculation of the model to the fixed decimal point? The results of my current model are array([[6.527474e-05, 5.269228e-05, 9.998820e-01]], dtype=float32) I want my model output - (9.998820e-01) -> 0.9998820 回答1: Both are actually the same. (9.998820e-01) and 0.9998820 you can enable this option, to display the numbers without scientific notation while you print the numpy arrays. np.set

My deep learning model is not training. How do I make it train?

∥☆過路亽.° 提交于 2021-01-05 09:10:45
问题 I'm fairly new to Keras, please excuse me if I made a fundamental error. So, my model has 3 Convolutional (2D) layers and 4 Dense Layers, interspersed with Dropout Layers. I am trying to train a Regression Model using images. X_train.shape = (5164, 160, 320, 3) y_train.shape = (5164) from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense, Flatten, Conv2D, Activation, MaxPooling2D, Dropout import tensorflow.compat.v1 as tf tf.disable_v2_behavior() from tensorflow

My deep learning model is not training. How do I make it train?

社会主义新天地 提交于 2021-01-05 09:09:16
问题 I'm fairly new to Keras, please excuse me if I made a fundamental error. So, my model has 3 Convolutional (2D) layers and 4 Dense Layers, interspersed with Dropout Layers. I am trying to train a Regression Model using images. X_train.shape = (5164, 160, 320, 3) y_train.shape = (5164) from tensorflow.keras import Sequential from tensorflow.keras.layers import Dense, Flatten, Conv2D, Activation, MaxPooling2D, Dropout import tensorflow.compat.v1 as tf tf.disable_v2_behavior() from tensorflow

RuntimeError: Unable to create link (name already exists) Keras

回眸只為那壹抹淺笑 提交于 2021-01-05 07:39:53
问题 When I save my model I get the following error: --------------------------------------------------------------------------- RuntimeError Traceback (most recent call last) <ipython-input-40-853303da8647> in <module>() 7 8 ----> 9 model.save(outdir+'model.h5') 10 11 5 frames /usr/local/lib/python3.6/dist-packages/h5py/_hl/group.py in __setitem__(self, name, obj) 371 372 if isinstance(obj, HLObject): --> 373 h5o.link(obj.id, self.id, name, lcpl=lcpl, lapl=self._lapl) 374 375 elif isinstance(obj,

How does DQN work in an environment where reward is always -1

删除回忆录丶 提交于 2021-01-05 07:14:05
问题 Given that the OpenAI Gym environment MountainCar-v0 ALWAYS returns -1.0 as a reward (even when goal is achieved), I don't understand how DQN with experience-replay converges, yet I know it does, because I have working code that proves it. By working, I mean that when I train the agent, the agent quickly (within 300-500 episodes) learns how to solve the mountaincar problem. Below is an example from my trained agent. It is my understanding that ultimately there needs to be a "sparse reward"

Coremltools error while converting: “'str' object has no attribute 'decode'” [duplicate]

五迷三道 提交于 2021-01-05 06:04:16
问题 This question already has an answer here : Save keras model as .h5 (1 answer) Closed last month . I am trying to use coremltools to convert a keras model to mlmodel. I am getting the following code: import coremltools import keras output_labels = list(range(1, 43)) your_model = coremltools.converters.keras.convert('my_model.h5', input_names=['image'], output_names=['output'], class_labels=output_labels, image_input_names='image') #your_model.author = 'your name' #your_model.short_description

Coremltools error while converting: “'str' object has no attribute 'decode'” [duplicate]

时间秒杀一切 提交于 2021-01-05 06:03:45
问题 This question already has an answer here : Save keras model as .h5 (1 answer) Closed last month . I am trying to use coremltools to convert a keras model to mlmodel. I am getting the following code: import coremltools import keras output_labels = list(range(1, 43)) your_model = coremltools.converters.keras.convert('my_model.h5', input_names=['image'], output_names=['output'], class_labels=output_labels, image_input_names='image') #your_model.author = 'your name' #your_model.short_description

Pixelate ROI bounding box and overlay it on original image using OpenCV

蓝咒 提交于 2021-01-05 06:00:13
问题 Lets make it straightforward. I have private project to block or pixelate image using boundary box in open-cv, something like censoring image, inspired from this paper: https://www.researchgate.net/publication/325746502_Seamless_Nudity_Censorship_an_Image-to-Image_Translation_Approach_based_on_Adversarial_Training I have found the way to classify the area of censor using Keras, but still don't know the way how to use the boundary box to pixelate the classified area, and overlay it to original

【技术分享】⾯向隐私AI的TensorFlow深度定制化实践

柔情痞子 提交于 2021-01-05 05:33:15
作者:Rosetta技术团队 策划:蔡芳芳 在上⼀篇⽂章中, 【技术分享】隐私AI工程技术实践指南 ,我们整体上了介绍了基于深度学习框架开发隐私AI框架的⼯程挑战和可⾏解决⽅案。在这⼀篇⽂章中,我们进⼀步结合Rosetta介绍如何定制化改造TensorFlow前后端相关组件,以集成MPC等隐私计算技术,同时保留对TensorFlow接口API的复⽤,从⽽实现我们上⼀篇⽂章中所强调的“系统易⽤性”。 ⽬前Rosetta主要基于TensorFlow 1.14 CPU版本加以开发(以下简称TensorFlow为TF),这是因为TF 1.x⽬前在⼯业界中实际应⽤较为⼴泛,⽽引⼊动态图等⾼级功能的TF 2.0,则由于接⼝不向后兼容等问题,仍没有得到⼤规模落地。后续我们也将在Rosetta本身功能稳定的基础上考虑⽀持TF 2.0。下⾯就让我们开始吧。 TensorFlow 快速回顾 想要基于AI框架进⼀步扩展引⼊隐私计算功能,第⼀步需要⽐较深⼊地了解这些AI框架,所以⾸先让我们简单回顾⼀下TF的核⼼概念以及宏观的内部处理过程。 TensorFlow 核心概念 > > > > Tensor(张量) 深度学习需要完成对⼤量⾼维度复杂数据的处理,在TensorFlow中,⽤Tensor来封装同⼀类型数据的⾼维数组。其中,基础类型除了各种不同精度的整数、浮点数外,还⽀持 tf.string 类型

Tensorflow Model Subclassing Mutli-Input

喜你入骨 提交于 2021-01-04 09:21:28
问题 I am using the keras subclassing module to re-make a previously functional model that requires two inputs and two outputs. I cannot find any documentation on if/how this is possible. Does the TF2.0/Keras subclassing API allow for mutli-input? Input to my functional model, and the build is simple: word_in = Input(shape=(None,)) # sequence length char_in = Input(shape=(None, None)) ... layers... m = Model(inputs=[word_in, char_in], outputs=[output_1, output_2]) 回答1: Sub-classed model for