keras

Passing output of a CNN to BILSTM

旧巷老猫 提交于 2021-02-08 06:15:31
问题 I am working on a project in which I have to pass the output of CNN to Bi directional LSTM. I created the model as below but it is throwing 'incompatible' error. Please let me know where I am going wrong and how to fix this model = Sequential() model.add(Conv2D(filters = 16, kernel_size = 3,input_shape = (32,32,1))) model.add(BatchNormalization()) model.add(MaxPooling2D(pool_size=(2,2),strides=1, padding='valid')) model.add(Activation('relu')) model.add(Conv2D(filters = 32, kernel_size=3))

Keras the simplest NN model: error in training.py with indices

允我心安 提交于 2021-02-08 06:14:31
问题 I have read this example https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py and decide to use this idea to my base because this is the simplest NN for Keras. This is my base https://drive.google.com/file/d/0B-B3QUQOzGZ7WVhzQmRsOTB0eFE/view (you can download my csv file, it's only 83Kb ) This is picture my base: base.shape = (891, 23) import keras from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout from keras.optimizers

Keras the simplest NN model: error in training.py with indices

大城市里の小女人 提交于 2021-02-08 06:14:29
问题 I have read this example https://github.com/fchollet/keras/blob/master/examples/mnist_mlp.py and decide to use this idea to my base because this is the simplest NN for Keras. This is my base https://drive.google.com/file/d/0B-B3QUQOzGZ7WVhzQmRsOTB0eFE/view (you can download my csv file, it's only 83Kb ) This is picture my base: base.shape = (891, 23) import keras from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout from keras.optimizers

YOLOv4损失函数全面解析

拜拜、爱过 提交于 2021-02-08 05:40:04
点击上方“ 视学算法 ”,选择“ 星标 ”公众号 精选作品,第一时间送达 来源|周威@知乎,https://zhuanlan.zhihu.com/p/159209199 本文已获作者授权,不得二次转载。 1.前言 如果您对YOLO V4的结构比较感兴趣,建议您可以结合代码以及我的这篇文章进行 消化 。代码是基于Keras版本的,结构很清晰,链接如下: YOLO V4 Keras:https:github.com/Ma-Dan/keras-yolo4 YOLO V4相较于YOLO V3做了很多 小创新 ,堪称目标检测tricks万花筒。既然YOLO V4结构大家都懂了,根据网络的 输出 和 标签信息 进行损失函数的设定,实现网络参数的更新,一个完整的YOLO V4模型训练过程就可以被复现了。 YOLO V4原文中提到,在进行bounding box regression的时候,传统的目标检测模型(比如YOLO V3)等,都是直接根据 预测框 和 真实框 的 中心点坐标 以及 宽高信息 设定 MSE(均方误差)损失函数 的。为了方便大家理解,下面给出了YOLO V3的总损失函数。 YOLO V3的损失函数 可以看出,第一行的两个,就是用在bounding box regression的损失函数MSE。有关该损失函数的具体解析可以见我文章《YOLO V3 深度解析 (下)》(https:

中阶API示范

╄→гoц情女王★ 提交于 2021-02-08 05:30:20
TensorFlow有5个不同的层次结构:即 硬件层 , 内核层 , 低阶API , 中阶API , 高阶API 。本章我们将以线性回归为例,直观对比展示在低阶API,中阶API,高阶API这三个层级实现模型的特点。 TensorFlow的层次结构从低到高可以分成如下五层。 最底层为硬件层,TensorFlow支持CPU、GPU或TPU加入计算资源池。 第二层为C++实现的内核,kernel可以跨平台分布运行。 第三层为Python实现的操作符,提供了封装C++内核的低级API指令,主要包括各种张量操作算子、计算图、自动微分. 如tf.Variable,tf.constant,tf.function,tf.GradientTape,tf.nn.softmax... 如果把模型比作一个房子,那么第三层API就是【模型之砖】。 第四层为Python实现的模型组件,对低级API进行了函数封装,主要包括各种模型层,损失函数,优化器,数据管道,特征列等等。 如tf.keras.layers,tf.keras.losses,tf.keras.metrics,tf.keras.optimizers,tf.data.Dataset,tf.feature_column... 如果把模型比作一个房子,那么第四层API就是【模型之墙】。 第五层为Python实现的模型成品

is there a nice output of Keras model.summary( )?

我的未来我决定 提交于 2021-02-08 04:51:32
问题 is it possible to have a nice output of keras model.summary(), that can be included in paper, or can be ploted in a nice table like this. 回答1: You need to install graphvis and pydot, but you might like the results from this. It doesn't make a table but the graph is much better in my opinion. from keras.utils import plot_model plot_model(model, to_file='model.png', show_shapes=True,show_layer_names=True) But you would have to make properly named sub models if you want to nest the several

Inference on GPU with Keras

…衆ロ難τιáo~ 提交于 2021-02-08 04:00:55
问题 I'm trying to make predictions with Keras using my RTX 2060 Super. For some reason, it appears to be running on my CPU instead. Here's the test script I was using for debugging: import numpy as np import tensorflow as tf from keras import Sequential from keras.layers import Conv2D, Flatten, Dense def get_model(): model = Sequential() model.add(Conv2D(32, (3, 3), input_shape=(6, 7, 3), activation='relu')) model.add(Conv2D(32, (3, 3), activation='relu')) model.add(Flatten()) model.add(Dense(16,

Inference on GPU with Keras

社会主义新天地 提交于 2021-02-08 03:59:35
问题 I'm trying to make predictions with Keras using my RTX 2060 Super. For some reason, it appears to be running on my CPU instead. Here's the test script I was using for debugging: import numpy as np import tensorflow as tf from keras import Sequential from keras.layers import Conv2D, Flatten, Dense def get_model(): model = Sequential() model.add(Conv2D(32, (3, 3), input_shape=(6, 7, 3), activation='relu')) model.add(Conv2D(32, (3, 3), activation='relu')) model.add(Flatten()) model.add(Dense(16,

Cannot import multi_gpu_model from keras.utils

狂风中的少年 提交于 2021-02-08 03:28:05
问题 I have tensorflow-gpu 1.2.1 and keras on ubuntu 16.04. I am not able to perform: from kears.utils import multi_gpu_model Has anyone had success with multi_gpu_model as described in their documentation's FAQ section? I have a 4 GPU machine with 4 GeForce GTX 1080 Ti cards and want to use all of them. Here's the error I get: import keras.utils.multi_gpu_model --------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last)

全面解析YOLO V4网络结构

空扰寡人 提交于 2021-02-08 02:54:42
作者|周威,https://zhuanlan.zhihu.com/p/150127712 本文已获作者授权,不得二次转载。 1.前言 最近用YOLO V4做车辆检测,配合某一目标追踪算法实现 车辆追踪+轨迹提取 等功能,正好就此结合论文和代码来对 YOLO V4 做个解析。先放上个效果图(半成品),如下: 话不多说,现在就开始对YOLO V4进行总结。 YOLO V4的论文:《 YOLOv4: Optimal Speed and Accuracy of Object Detection》 ,相信大家也是经常看到这几个词眼:大神接棒、YOLO V4来了、Tricks 万花筒等等。 没错,通过阅读YOLO V4的原文,我觉得它更像一篇 目标检测模型Tricks文献综述 ,可见作者在目标检测领域的知识(炼丹技术)积累之多。 从本质上,YOLO V4就是 筛选 了 一些 从YOLO V3发布至今,被用在各式各样检测器上,能够 提高检测精度 的 tricks ,并以YOLO V3为 基础 进行改进的目标检测模型。YOLO V4在保证速度的同时,大幅提高模型的检测精度(当然,这是相较于YOLO V3的)。 上图可以看出来,虽然检测精度不如EfficientDet这种变态,但是速度上是遥遥领先的,说明YOLO V4并没有忘记初心(速度和精度的trade off,我YOLO才是佼佼者)!