tensorflow

Tensorflow : ImportError: DLL load failed

我们两清 提交于 2021-02-11 13:55:26
问题 I am using Windows 10, Python 3.7.8 and PyCharm. First, I installed Python 3.7.8. Then I installed PyCharm. I am trying to run Python code, to be specific Tensorflow code. I follow these instructions here: https://www.tensorflow.org/site-assets/downloads/marketing/cert/Setting_Up_TF_Developer_Certificate_Exam.pdf Page 4-8. As in the instructions I create a new PyCharm project: Then in the preferences for this Project, choosing Python Interpreter I install the following packages: tensorflow

how to set inter_op_parallelism_threads and intra_op_parallelism_threads for seesion configuration in Tensorflow c++

浪尽此生 提交于 2021-02-11 13:52:46
问题 I know how to set intra and inter threads in python tensorflow which is as shown below n_cpus=1 sess = tf.Session(config=tf.ConfigProto( device_count={ "CPU": n_cpus }, inter_op_parallelism_threads=n_cpus, intra_op_parallelism_threads=8 )); But I need to implement this in c++. SO any equivalent code to set inter and intra threads in tensorflow c++ ?? 回答1: You can implement this in C++ by using the following code. Status LoadGraph(string graph_file_name, std::unique_ptr<tensorflow::Session>*

tensorflow backend error. AttributeError: module 'tensorflow' has no attribute 'name_scope'

。_饼干妹妹 提交于 2021-02-11 13:51:19
问题 I'm using Version: 2.1.0 of TensorFlow and 2.3.1 of keras. While importing any module of keras i'm facing below tensorflow back-end error. import pandas as pd, numpy as np, os, re, json, math, time from keras.models import Sequential from keras.layers import Dense from keras.wrappers.scikit_learn import KerasRegressor from sklearn.model_selection import cross_val_score from sklearn.model_selection import KFold from sklearn.preprocessing import StandardScaler from sklearn.pipeline import

TensorFlow 2 How to use *args in tf.function?

笑着哭i 提交于 2021-02-11 13:40:56
问题 Update: Did a bit more testing and I can't reproduce the behaviour with: import tensorflow as tf import numpy as np @tf.function def tf_being_unpythonic(an_input, another_input): return an_input + another_input @tf.function def example(*inputs, other_args = True): return tf_being_unpythonic(*inputs) class TestClass(tf.keras.Model): def __init__(self, a, b): super().__init__() self.a= a self.b = b @tf.function def call(self, *inps, some_kwarg=False): if some_kwarg: return self.a(*inps) return

LSTM produces identical forecast for each input

不羁的心 提交于 2021-02-11 13:25:36
问题 I've been working on reproducing a CNN-LSTM model for PV power forecasting from literature for the past four weeks for my Master Thesis in Energy Science (http://www.mdpi.com/2076-3417/8/8/1286). However I've been stuck on a seemingly simple issue: Any configuration of LSTM model that I've tried yields one of two things: Rediculous output, makes no sense whatsoever (flat line, complete stochasticity, negative values, you name it) Exactly the same (very believable) PV power forecast. I've done

Patch based image training and combine their probability from an image

被刻印的时光 ゝ 提交于 2021-02-11 13:00:15
问题 Firstly, I have implemented a simple VGG16 network for image classification. model = keras.applications.vgg16.VGG16(include_top = False, weights = None, input_shape = (32,32,3), pooling = 'max', classes = 10) Whose input shape is 32 x 32 . Now, I am trying to implement a patch-based neural network . The main idea is, from the input image, extract 4 image patch like this image, and train the extracted patch image( resizing to 32 x 32 as it is input shape of our model) finally, combine their

深度学习实现安全帽佩戴的检测

眉间皱痕 提交于 2021-02-11 12:49:01
向AI转型的程序员都关注了这个号 👇👇👇 机器学习AI算法工程 公众号:datayx 01. 概述 对于图像识别,采用传统的算法(opencv的一些算法),判断形状、颜色等等,我们在实验室和办公场所做测试,效果还不错,和容易识别出来。一旦到了工业现场,图像完全不行,连人和车都识别不出来。在不同光线下不论采用什么颜色空间(RGB、HSV什么)都无法分离出合理的色彩,更不要提判断和检测了。有感于实际的现场环境,决定放弃传统的算法,拿起深度学习的工具,来搞定这个项目。 02. 数据准备 高大上的人工智能背后,一定是苦逼的数据准备,深度学习的模型,需要成千上万的训练和测试数据,这些数据的采集和整理,还有数据的清洗都是体力活啊。 当然,我还是没傻到一张张去拍照片。我通过现场的摄像头做了视频采集,然后拿到录像,做了一个代码从录像中找到人,再把人的上半部分处理一下,变成标准格式的图片。这样子,2-3天的录像就可以产生几十万张图片了,看来训练集的问题解决了。 采用SSD的算法(用于物体检测的深度学习主流算法之一)检测出图片中的人。 这样就可以建立自己的训练集: train和test (带不带帽子的标注需要人工去做... 这个还是很苦逼) 03. 搭建模型 考虑到标准的图片只有128*128,特征不是很多,就动手搭建一个不算深的深度学习模型,采用卷积神经网络处理图形特征,搞过cnn的同学会觉得so

Convolution Neural Networks Intuition - Difference in outcome between high kernel filter size vs high number of features

…衆ロ難τιáo~ 提交于 2021-02-11 12:46:12
问题 I wanted to understand architectural intuition behind the differences of: tf.keras.layers.Conv2D(64, (3,3), activation='relu', input_shape=(28, 28, 1)) and tf.keras.layers.Conv2D(32, (7,7), activation='relu', input_shape=(28, 28, 1)) Assuming, As kernel size increases, more complex feature-pattern matching can be performed in the convolution step. As feature size increases, a larger variance of smaller features can define a particular layer. How and when (if possible kindly give scenarios) do

keras LSTM model - a tf 1.15 equivalent that works with tflite

喜夏-厌秋 提交于 2021-02-11 12:44:49
问题 TLDR : How to implement this model using tf.lite.experimental.nn.TFLiteLSTMCell, tf.lite.experimental.nn.dynamic_rnn instead keras.layers.LSTM ? I have this network in keras: inputs = keras.Input(shape=(1, 52)) state_1_h = keras.Input(shape=(200,)) state_1_c = keras.Input(shape=(200,)) x1, state_1_h_out, state_1_c_out = layers.LSTM(200, return_sequences=True, input_shape=(sequence_length, 52), return_state=True)(inputs, initial_state=[state_1_h, state_1_c]) output = layers.Dense(13)(x1) model

Should I be using tf.keras or keras in 2020?

馋奶兔 提交于 2021-02-11 12:42:48
问题 A while back I read this post on PyImageSearch and was satisfied enough to switch completely to tf.keras . But since then I noticed the Keras website got an overhaul and seems to be expanding on its ambitions. So I'm a bit confused. Is it still true that "the latest release of the keras package (v2.3.0) will be the last release to support multiple backends and feature updates. Moving forward, the keras package will receive only bug fixes." from PyImageSearch? If I stick with tf.keras could I