return load_dynamic(name, filename, file) tensorflow安装这个报错半年也没有解决

import tensorflow as tf
Traceback (most recent call last):
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow__init__.py", line 22, in
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python__init__.py", line 49, in
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Users\cheng\AppData\Local\Programs\Python\Python36\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。

安装报错

不要叫我退到安装1.5

2个回答

tensorflow-gpu 需要和cuda,cudnn版本对应。cuda又需要和英伟达驱动对应。
简单来说

cuda10支持 tf 1.13 以上
cuda9支持 tf 1.5-1.12
cuda8支持 tf 1.0-1.4

只能帮你这么多了。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
尝试打开tensorboard的时候ImportError: DLL load failed: 找不到指定的模块。
(tensorflow) C:\Users\14228\PycharmProjects\untitled>tensorboard --logdir=logs Traceback (most recent call last): File "d:\anaconda3\lib\runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "d:\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "D:\Anaconda3\Scripts\tensorboard.exe\__main__.py", line 5, in <module> File "d:\anaconda3\lib\site-packages\tensorboard\main.py", line 40, in <module> from tensorboard import default File "d:\anaconda3\lib\site-packages\tensorboard\default.py", line 38, in <module> from tensorboard.plugins.audio import audio_plugin File "d:\anaconda3\lib\site-packages\tensorboard\plugins\audio\audio_plugin.py", line 30, in <module> from tensorboard.util import tensor_util File "d:\anaconda3\lib\site-packages\tensorboard\util\tensor_util.py", line 20, in <module> import numpy as np File "d:\anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module> from . import _distributor_init File "d:\anaconda3\lib\site-packages\numpy\_distributor_init.py", line 34, in <module> from . import _mklinit ImportError: DLL load failed: 找不到指定的模块。
Alarm Clock 的问题求解
Problem Description Advanced courses in computer science often include many interesting optimization problems. The following optimization problem is not advanced, nor is it particularly interesting. You are to write a program to determine the minimum number of buttons a person must push to set their alarm clock. Assume the alarm clock has 7 buttons – hour-up, hour-down, tens-minute-up, and tens-minute-down, ones-minute-up, ones-minute-down, and am/pm. For example, continuously pushing the hour-up button will cause hour digit to go through the sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1, 2, …. Pushing the hour-down button will cause the sequence to go in the reverse order. Pushing the tens-minute-up buttons cycles tens minute digit through the numbers 0, 1, 2, 3, 4, 5, 0, 1, … Pushing the ones-minute-up button cycles the one digit through the numbers 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, … Pushing the am/pm button causes toggles the am/pm indicator. Input The first line of input will contain an integer indicating the number of problems that need to be processed. Each line will contain two times – the first one the current time and the second one the desired time. All times will have the format: 1 or 2-digit hour; followed by a colon; followed by a 2-digit minute; followed by “am” or “pm”. A single space will separate the two times. Output Your program should produce one line of output for each problem using one of two formats: ”Going from 7:30am to 7:33am requires 3 pushes.” or “Going from 7:30am to 7:20am requires 1 push.” Sample Input 6 7:30am 7:30am 7:30am 7:33am 7:30am 7:20am 7:30am 7:27am 7:30am 7:30pm 7:10am 7:50am Sample Output Going from 7:30am to 7:30am requires 0 pushes. Going from 7:30am to 7:33am requires 3 pushes. Going from 7:30am to 7:20am requires 1 push. Going from 7:30am to 7:27am requires 4 pushes. Going from 7:30am to 7:30pm requires 1 push. Going from 7:10am to 7:50am requires 2 pushes.
Roman Expressions 罗马字母的问题
Problem Description As any other marketing company, ACM produces a lot of funky advertising items that may contain a logo and be given to customers and business partners as small gifts. A unique specialty of ACM is a calculator that uses roman numbers. Roman numbers are able to express any non-negative integer using uppercase letters: Numbers are created by appending several letters together, the letter representing a higher value must always precede letters with lower values. The only exception are the letters “I”, “X”, and “C”, they may be used before higher letters to form values expressed by digits 4 and 9. The only possible combinations are: Any roman number must first express thousands, then hundreds, tens, and ones. Therefore, 499 must always be written as “CDXCIX”, not “ID”. Although not very practical, this gift is considered extremely “cooooool”. Your task is to write software for that calculator. Input The input will consist from commands, each written on a separate line. Possible commands are assignments, “RESET”, and “QUIT”. An assignment command starts with a single digit representing one of ten registers that the calculator has. The register number is followed by an equal sign (“=”) and an expression. The expression will consist only from valid roman numbers, register names (digits), plus (“+”) and minus (“-”) signs. You may assume that the expression will always be valid and no longer than 10000 characters. Output For each command, output a single line. For assignments, print the register name, equal sign, and the value that is being assigned to that register. Instead of it, print the word “Error”, if the expression contains a reference to a register that has not been assigned before, or if the result is negative or larger than 10000. In such cases, no change to register values is made. For RESET commands, invalidate all previous register assignments and print the word “Ready”. The QUIT command will be the last one. Print the word “Bye” and terminate the program. Sample Input 1=MC+IV-X 1=1+1 RESET 1=1+X 1=MM 1=1+1+1+1+1 2=1+1 QUIT Sample Output 1=MXCIV 1=MMCLXXXVIII Ready Error 1=MM 1=MMMMMMMMMM Error Bye
求教,跑tensorflow-gpu测试代码时报错cudaGetDevice() failed. Status: cudaGetErrorString symbol not found
![图片说明](https://img-ask.csdn.net/upload/201911/20/1574255233_540412.png) cuda版本![图片说明](https://img-ask.csdn.net/upload/201911/20/1574255339_304467.png) python版本3.7
Roman Expressions 怎么来编写
Problem Description As any other marketing company, ACM produces a lot of funky advertising items that may contain a logo and be given to customers and business partners as small gifts. A unique specialty of ACM is a calculator that uses roman numbers. Roman numbers are able to express any non-negative integer using uppercase letters: Numbers are created by appending several letters together, the letter representing a higher value must always precede letters with lower values. The only exception are the letters “I”, “X”, and “C”, they may be used before higher letters to form values expressed by digits 4 and 9. The only possible combinations are: Any roman number must first express thousands, then hundreds, tens, and ones. Therefore, 499 must always be written as “CDXCIX”, not “ID”. Although not very practical, this gift is considered extremely “cooooool”. Your task is to write software for that calculator. Input The input will consist from commands, each written on a separate line. Possible commands are assignments, “RESET”, and “QUIT”. An assignment command starts with a single digit representing one of ten registers that the calculator has. The register number is followed by an equal sign (“=”) and an expression. The expression will consist only from valid roman numbers, register names (digits), plus (“+”) and minus (“-”) signs. You may assume that the expression will always be valid and no longer than 10000 characters. Output For each command, output a single line. For assignments, print the register name, equal sign, and the value that is being assigned to that register. Instead of it, print the word “Error”, if the expression contains a reference to a register that has not been assigned before, or if the result is negative or larger than 10000. In such cases, no change to register values is made. For RESET commands, invalidate all previous register assignments and print the word “Ready”. The QUIT command will be the last one. Print the word “Bye” and terminate the program. Sample Input 1=MC+IV-X 1=1+1 RESET 1=1+X 1=MM 1=1+1+1+1+1 2=1+1 QUIT Sample Output 1=MXCIV 1=MMCLXXXVIII Ready Error 1=MM 1=MMMMMMMMMM Error Bye
InvalidArgumentError: Input to reshape is a tensor with 152000 values, but the requested shape requires a multiple of 576
运行无提示,也没有输出数据,求大神帮助! # -*- coding: utf-8 -*- """ Created on Fri Oct 4 10:01:03 2019 @author: xxj """ import numpy as np from sklearn import preprocessing import tensorflow as tf from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt import pandas as pd #读取CSV文件数据 # 从CSV文件中读取数据,返回DataFrame类型的数据集合。 def zc_func_read_csv(): zc_var_dataframe = pd.read_csv("highway.csv", sep=",") # 打乱数据集合的顺序。有时候数据文件有可能是根据某种顺序排列的,会影响到我们对数据的处理。 zc_var_dataframe = zc_var_dataframe.reindex(np.random.permutation(zc_var_dataframe.index)) return zc_var_dataframe # 预处理特征值 def preprocess_features(highway): processed_features = highway[ ["line1","line2","line3","line4","line5", "brige1","brige2","brige3","brige4","brige5", "tunnel1","tunnel2","tunnel3","tunnel4","tunnel5", "inter1","inter2","inter3","inter4","inter5", "econmic1","econmic2","econmic3","econmic4","econmic5"] ] return processed_features # 预处理标签 highway=zc_func_read_csv() x= preprocess_features(highway) outtarget=np.array(pd.read_csv("highway1.csv")) y=np.array(outtarget[:,[0]]) print('##################################################################') # 随机挑选 train_x_disorder, test_x_disorder, train_y_disorder, test_y_disorder = train_test_split(x, y,train_size=0.8, random_state=33) #数据标准化 ss_x = preprocessing.StandardScaler() train_x_disorder = ss_x.fit_transform(train_x_disorder) test_x_disorder = ss_x.transform(test_x_disorder) ss_y = preprocessing.StandardScaler() train_y_disorder = ss_y.fit_transform(train_y_disorder.reshape(-1, 1)) test_y_disorder=ss_y.transform(test_y_disorder.reshape(-1, 1)) #变厚矩阵 def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial) #偏置 def bias_variable(shape): initial = tf.constant(0.1, shape=shape) return tf.Variable(initial) #卷积处理 变厚过程 def conv2d(x, W): # stride [1, x_movement, y_movement, 1] x_movement、y_movement就是步长 # Must have strides[0] = strides[3] = 1 padding='SAME'表示卷积后长宽不变 return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME') #pool 长宽缩小一倍 def max_pool_2x2(x): # stride [1, x_movement, y_movement, 1] return tf.nn.max_pool(x, ksize=[1,2,2,1], strides=[1,2,2,1], padding='SAME') # define placeholder for inputs to network xs = tf.placeholder(tf.float32, [None, 25]) #原始数据的维度:25 ys = tf.placeholder(tf.float32, [None, 1])#输出数据为维度:1 keep_prob = tf.placeholder(tf.float32)#dropout的比例 x_image = tf.reshape(xs, [-1, 5, 5, 1])#原始数据25变成二维图片5*5 ## conv1 layer ##第一卷积层 W_conv1 = weight_variable([2,2, 1,32]) # patch 2x2, in size 1, out size 32,每个像素变成32个像素,就是变厚的过程 b_conv1 = bias_variable([32]) h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1) # output size 2x2x32,长宽不变,高度为32的三维图像 #h_pool1 = max_pool_2x2(h_conv1) # output size 2x2x32 长宽缩小一倍 ## conv2 layer ##第二卷积层 W_conv2 = weight_variable([2,2, 32, 64]) # patch 2x2, in size 32, out size 64 b_conv2 = bias_variable([64]) h_conv2 = tf.nn.relu(conv2d(h_conv1, W_conv2) + b_conv2) #输入第一层的处理结果 输出shape 4*4*64 ## fc1 layer ## full connection 全连接层 W_fc1 = weight_variable([3*3*64, 512])#4x4 ,高度为64的三维图片,然后把它拉成512长的一维数组 b_fc1 = bias_variable([512]) h_pool2_flat = tf.reshape(h_conv2, [-1, 3*3*64])#把3*3,高度为64的三维图片拉成一维数组 降维处理 h_fc1 = tf.nn.relu(tf.matmul(h_pool2_flat, W_fc1) + b_fc1) h_fc1_drop = tf.nn.dropout(h_fc1, keep_prob)#把数组中扔掉比例为keep_prob的元素 ## fc2 layer ## full connection W_fc2 = weight_variable([512, 1])#512长的一维数组压缩为长度为1的数组 b_fc2 = bias_variable([1])#偏置 #最后的计算结果 prediction = tf.matmul(h_fc1_drop, W_fc2) + b_fc2 #prediction = tf.nn.relu(tf.matmul(h_fc1_drop, W_fc2) + b_fc2) # 计算 predition与y 差距 所用方法很简单就是用 suare()平方,sum()求和,mean()平均值 cross_entropy = tf.reduce_mean(tf.reduce_sum(tf.square(ys - prediction), reduction_indices=[1])) # 0.01学习效率,minimize(loss)减小loss误差 train_step = tf.train.AdamOptimizer(0.01).minimize(cross_entropy) sess = tf.Session() # important step # tf.initialize_all_variables() no long valid from # 2017-03-02 if using tensorflow >= 0.12 sess.run(tf.global_variables_initializer()) #训练500次 for i in range(100): sess.run(train_step, feed_dict={xs: train_x_disorder, ys: train_y_disorder, keep_prob: 0.7}) print(i,'误差=',sess.run(cross_entropy, feed_dict={xs: train_x_disorder, ys: train_y_disorder, keep_prob: 1.0})) # 输出loss值 # 可视化 prediction_value = sess.run(prediction, feed_dict={xs: test_x_disorder, ys: test_y_disorder, keep_prob: 1.0}) ###画图########################################################################### fig = plt.figure(figsize=(20, 3)) # dpi参数指定绘图对象的分辨率,即每英寸多少个像素,缺省值为80 axes = fig.add_subplot(1, 1, 1) line1,=axes.plot(range(len(prediction_value)), prediction_value, 'b--',label='cnn',linewidth=2) #line2,=axes.plot(range(len(gbr_pridict)), gbr_pridict, 'r--',label='优选参数') line3,=axes.plot(range(len(test_y_disorder)), test_y_disorder, 'g',label='实际') axes.grid() fig.tight_layout() #plt.legend(handles=[line1, line2,line3]) plt.legend(handles=[line1, line3]) plt.title('卷积神经网络') plt.show()
Tensorflow代码转到Keras
我现在有Tensortflow的代码和结构图如下,这是AC-GAN中生成器的部分,我用原生tf是可以跑通的,但当我想转到Keras中实现却很头疼。 ``` def batch_norm(inputs, is_training=is_training, decay=0.9): return tf.contrib.layers.batch_norm(inputs, is_training=is_training, decay=decay) # 构建残差块 def g_block(inputs): h0 = tf.nn.relu(batch_norm(conv2d(inputs, 3, 64, 1, use_bias=False))) h0 = batch_norm(conv2d(h0, 3, 64, 1, use_bias=False)) h0 = tf.add(h0, inputs) return h0 # 生成器 # batch_size = 32 # z : shape(32, 128) # label : shape(32, 34) def generator(z, label): with tf.variable_scope('generator', reuse=None): d = 16 z = tf.concat([z, label], axis=1) h0 = tf.layers.dense(z, units=d * d * 64) h0 = tf.reshape(h0, shape=[-1, d, d, 64]) h0 = tf.nn.relu(batch_norm(h0)) shortcut = h0 for i in range(16): h0 = g_block(h0) h0 = tf.nn.relu(batch_norm(h0)) h0 = tf.add(h0, shortcut) for i in range(3): h0 = conv2d(h0, 3, 256, 1, use_bias=False) h0 = tf.depth_to_space(h0, 2) h0 = tf.nn.relu(batch_norm(h0)) h0 = tf.layers.conv2d(h0, kernel_size=9, filters=3, strides=1, padding='same', activation=tf.nn.tanh, name='g', use_bias=True) return h0 ``` ![生成器结构图](https://img-ask.csdn.net/upload/201910/29/1572278934_997142.png) 在Keras中都是先构建Model,在Model中不断的加层 但上面的代码却是中间包含着新旧数据的计算,比如 ``` .... shortcut = h0 .... h0 = tf.add(h0, shortcut) ``` 难不成我还要构建另外一个model作为中间输出吗? 大佬们帮帮忙解释下,或者能不能给出翻译到Keras中应该怎么写
请教高手:如何比较完美的进行HALCON标定与图像矫正?
用标定助手,进行标定。采用的是12mm的镜头,2448*2028 500万像素的相机。 遇到了几个问题,望高手帮忙指点一下: 1、加载标定板图片,几乎每一张图片都会提示 : 1)图像:“品质评估出错” 2)序列:“检测出某些图像的品质有问题” 参考了halcon unse-guide中的相关说明,以及网上的帖子,比如: 1、 halcon中你不知道的标定板细节: https://www.cnblogs.com/xiaomaLV2/p/5011011.html 2、https://www.51halcon.com/thread-1161-1-1.html 中有位网友讲到的一下一些注意事项: 1)标定板不要过曝,不要出现255的灰度值 2)光照要均匀 3)标定板特征点的对比度要高,黑白区域灰度值差100以上 4)标定板在图像中至少占1/4面积 5)特征点应该对焦清晰 6)所有特征点应该全部落在图像范围内 7)标定图像至少10幅 8)标定板应该覆盖整个视野的各个角落 9)标定板角度变化要明显 10)图像大小要一致 根据这些,拍了几十张标定板的照片,没有一张是显示为“确定”(即正常、合格 的意思) ![图片说明](https://img-ask.csdn.net/upload/201910/30/1572422563_859285.jpg) 请高手帮忙指点: 1、如何才能拍出没有品质问题的标定板图片,使其在赞入后显示为“确定”。 2、在标定助手中,需要选一张图片“设为参考位姿”,请问这个图片该如何选择比较合适? 3、标定时应该如何选择相关勾选项/设置项,便可以使用得到的参数,对图像的径向和切向畸变都可以进行矫正? 看一位网友的帖子,说是可以对切向畸变也进行矫正,但是在算子change_radial_distortion_cam_par('adaptive',CameraParameters,[0,0,0,0,0],CarParamVirtualFixed)中,又把参数“DistortionCoeffs”的值全部设置为0(,[0,0,0,0,0])。这样设置合理吗?还是需要给出该参数的具体值?如果是,其中的每一个值该如何确定? 4、得到标定参数后,对HALCON标定板图片,进行矫正,然后测量每个黑点的面积,发现: 1)矫正前后,不同的黑点面积并不是非常接近。 2)矫正后,黑点面积最大值和最小值的差是有一定的缩小。 这样的结果正常吗? 请高手不吝赐教。非常感谢!
如何采用深度学习进行工地安全帽佩戴的行为检测
目前安全帽检测都是分两步进行的,从视频流中提取图片后先采用ssd或者yolo检测出人,然后提取出头部信息,进行一个精确的检测。 请问大神们是如何从人的检测框中确定头部位置的(工地作业时工人并不是一直都是站立的),以及采用何种算法检测头部信息的。由于摄像头较远,有些检测尺度很小,检测头部信息时如何提高准确率呢?由于检测实时性的要求,如何提高检测速度呢?
Linux下,TensorFlow使用
Xshell中,anaconda下,TensorFlow激活后无法退出,不知道怎么使用。。。 ![图片说明](https://img-ask.csdn.net/upload/201911/11/1573463017_475077.png) (DenseFuse) yt@vccl:~/anaconda3/bin$ import tensorflow as tf print()^[[D''^H^H^[[3~ print("hello tf'") pritn print(" pring^H^H print('hello tf') exit() cona^H^H d^Hc condd^H conda activate conda deactivate python source deactifa source deactivate
tensorflow RNN LSTM代码运行不正确?
报错显示是ValueError: None values not supported. 在cross_entropy处有问题。谢谢大家 ``` #7.2 RNN import tensorflow as tf #tf.reset_default_graph() from tensorflow.examples.tutorials.mnist import input_data #载入数据集 mnist = input_data.read_data_sets("MNIST_data/", one_hot = True) #输入图片是28*28 n_inputs = 28 #输入一行,一行有28个数据 max_time = 28 #一共28行 lstm_size = 100 #隐层单元 n_classes = 10 #10个分量 batch_size = 50 #每批次50个样本 n_batch = mnist.train.num_examples//batch_size #计算共由多少个批次 #这里的none表示第一个维度可以是任意长度 x = tf.placeholder(tf.float32, [batch_size, 784]) #正确的标签 y = tf.placeholder(tf.float32, [batch_size, 10]) #初始化权值 weights = tf.Variable(tf.truncated_normal([lstm_size, n_classes], stddev = 0.1)) #初始化偏置 biases = tf.Variable(tf.constant(0.1, shape = [n_classes])) #定义RNN网络 def RNN(X, weights, biases): #input = [batch_size, max_size, n_inputs] inputs = tf.reshape(X, [-1, max_time, n_inputs]) #定义LSTM基本CELL lstm_cell = tf.nn.rnn_cell.BasicLSTMCell(lstm_size) #final_state[0]是cell_state #final_state[1]是hidden_state outputs, final_state = tf.nn.dynamic_rnn(lstm_cell, inputs, dtype = tf.float32) results = tf.nn.softmax(tf.matmul(final_state[1], weights) + biases) #计算RNN的返回结果 prediction = RNN(x, weights, biases) #损失函数 cross_entropy = tf.reduce_mean(tf.nn.softmax_cross_entropy_with_logits_v2(labels = y,logits = prediction)) #使用AdamOptimizer进行优化 train_step = tf.train.AdamOptimizer(1e-4).minimize(cross_entropy) #结果存放在一个布尔型列表中 correct_prediction = tf.equal(tf.argmax(y, 1),tf.argmax(prediction, 1)) #求准确率 accuracy = tf.reduce_mean(tf.cast(correct_precdition,tf.float32)) #初始化 init = tf.global_variable_initializer() with tf.Session() as sess: sess.run(init) for epoch in range(6): for batch in range(n_batch): batch_xs,batch_ys=mnist.train.next_batch(batch_size) sess.run(train_step,feed_dict={x:batch_xs,y:batch_ys}) acc = sess.run(accuracy, feed_dict={x:mnist.test.images,y:mnist.test.labels}) print('Iter' + str(epoch) + ',Testing Accuracy = ' + str(acc)) ```
如何防止过拟合?为何我的训练准确率高,但是测试准确率很低?
问题如标题 print('Training ------------') # training the model model.fit(X_train, y_train, epochs=8, batch_size=32,) Epoch 1/8 19578/19578 [==============================] - 334s 17ms/step - loss: 1.9936 - acc: 0.3272 Epoch 2/8 19578/19578 [==============================] - 325s 17ms/step - loss: 1.3145 - acc: 0.5698 Epoch 3/8 19578/19578 [==============================] - 325s 17ms/step - loss: 0.9667 - acc: 0.6897 Epoch 4/8 19578/19578 [==============================] - 325s 17ms/step - loss: 0.7580 - acc: 0.7557 Epoch 5/8 19578/19578 [==============================] - 325s 17ms/step - loss: 0.5882 - acc: 0.8095 Epoch 6/8 19578/19578 [==============================] - 325s 17ms/step - loss: 0.4548 - acc: 0.8510 Epoch 7/8 19578/19578 [==============================] - 325s 17ms/step - loss: 0.3471 - acc: 0.8839 Epoch 8/8 19578/19578 [==============================] - 325s 17ms/step - loss: 0.2524 - acc: 0.9176 print('\nTesting ------------') # Evaluate the model with the metrics we defined earlier loss, accuracy = model.evaluate(X_test1, y_test1) print('\ntest loss: ', loss) print('\ntest accuracy: ', accuracy) Testing ------------ 3000/3000 [==============================] - 16s 5ms/step test loss: 15.392780853271484 test accuracy: 0.045
我的keras的model.fit写在一个loop里,callback每一个epoch会生成一个events文件,如何处理这种问题?
if resume: # creates a generic neural network architecture model = Sequential() # hidden layer takes a pre-processed frame as input, and has 200 units model.add(Dense(units=200,input_dim=80*80, activation='relu', kernel_initializer='glorot_uniform')) # output layer model.add(Dense(units=1, activation='sigmoid', kernel_initializer='RandomNormal')) # compile the model using traditional Machine Learning losses and optimizers model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) #print model model.summary() if os.path.isfile('Basic_Rl_weights.h5'): #load pre-trained model weight print("loading previous weights") model.load_weights('Basic_Rl_weights.h5') else : # creates a generic neural network architecture model = Sequential() # hidden layer takes a pre-processed frame as input, and has 200 units model.add(Dense(units=200,input_dim=80*80, activation='relu', kernel_initializer='glorot_uniform')) # output layer model.add(Dense(units=1, activation='sigmoid', kernel_initializer='RandomNormal')) # compile the model using traditional Machine Learning losses and optimizers model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) #print model model.summary() #save model # model.save_weights('my_model_weights.h5') log_dir = './log' + datetime.now().strftime("%Y%m%d-%H%M%S") + "/" callbacks = callbacks.TensorBoard(log_dir=log_dir, histogram_freq=0, write_graph=True, write_images=True) # gym initialization env = gym.make("Pong-v0") observation = env.reset() prev_x = None # used in computing the difference frame running_reward = None # initialization of variables used in the main loop x_train, y_train, rewards = [],[],[] reward_sum = 0 episode_number = 0 # main loop while True: if render : env.render() # preprocess the observation, set input as difference between images cur_x = prepro(observation) # i=np.expand_dims(cur_x,axis=0) # print(i.shape) # print(cur_x.shape) if prev_x is not None : x = cur_x - prev_x else: x = np.zeros(Input_dim) # print(x.shape) # print(np.expand_dims(cur_x,axis=0).shape) prev_x = cur_x # forward the policy network and sample action according to the proba distribution # two ways to calculate returned probability # print(x.shape) prob = model.predict(np.expand_dims(x, axis=1).T) # aprob = model.predict(np.expand_dims(x, axis=1).T) if np.random.uniform() < prob: action = action_up else : action = action_down # 0 and 1 labels( a fake label in order to achive back propagation algorithm) if action == 2: y = 1 else: y = 0 # log the input and label to train later x_train.append(x) y_train.append(y) # do one step in our environment observation, reward, done, info = env.step(action) rewards.append(reward) reward_sum += reward # end of an episode if done: print('At the end of episode', episode_number, 'the total reward was :', reward_sum) # increment episode number episode_number += 1 # training # history = LossHistory() model.fit(x=np.vstack(x_train), y=np.vstack(y_train), verbose=1, sample_weight=discount_rewards(rewards), callbacks=[callbacks]) if episode_number % 100 == 0: model.save_weights('Basic_Rl_weights' + datetime.now().strftime("%Y%m%d-%H%M%S") + '.h5') # Log the reward running_reward = reward_sum if running_reward is None else running_reward * 0.99 + reward_sum * 0.01 # if episode_number % 10 == 0: tflog('running_reward', running_reward, custom_dir=log_dir) # Reinitialization x_train, y_train, rewards = [],[],[] observation = env.reset() reward_sum = 0 prev_x = None ``` ```
使用keras画出模型准确率评估的执行结果时出现:
建立好深度学习的模型后,使用反向传播法进行训练。 定义了训练方式: ``` model.compile(loss='categorical_crossentropy', optimizer='adam',metrics=['accuracy']) ``` 执行训练: ``` train_history =model.fit(x=x_Train_normalize, y=y_Train_OneHot,validation_split=0.2, epochs=10,batch_size=200,verbose=2) ``` 执行后出现: ![图片说明](https://img-ask.csdn.net/upload/201910/17/1571243584_952792.png) 建立show_train_history显示训练过程: ``` import matplotlib.pyplot as plt def show_train_history(train_history,train,validation): plt.plot(train_history.history[train]) plt.plot(train_history.history[validation]) plt.title('Train History') plt.ylabel(train) plt.xlabel('Epoch') plt.legend(['train','validation'],loc='upper left') plt.show() ``` 画出准确率执行结果: ``` show_train_history(train_history,'acc','val_acc') ``` 结果出现以下问题: ![图片说明](https://img-ask.csdn.net/upload/201910/17/1571243832_179270.png) 这是怎么回事呀? 求求大佬救救孩子555
Mask r-cnn 无法训练的问题
在做 https://github.com/matterport/Mask_RCNN 的复现。 在复现train_shpes时,在heads层训练时,卡在了Epoch 1/1。我观察下gpu和cpu,都没有工作 我在停止代码运行时发现停在了 File "<ipython-input-2-72119e4591c8>", line 1, in <module> runfile('D:/py/Mask_RCNN-master/samples/shapes/train_shapes.py', wdir='D:/py/Mask_RCNN-master/samples/shapes') File "D:\anaconda\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile execfile(filename, namespace) File "D:\anaconda\envs\tensorflow\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "D:/py/Mask_RCNN-master/samples/shapes/train_shapes.py", line 258, in <module> layers='heads') File "D:\py\Mask_RCNN-master\mrcnn\model.py", line 2352, in train use_multiprocessing=True, File "D:\anaconda\envs\tensorflow\lib\site-packages\keras\legacy\interfaces.py", line 87, in wrapper return func(*args, **kwargs) File "D:\anaconda\envs\tensorflow\lib\site-packages\keras\engine\training.py", line 2011, in fit_generator generator_output = next(output_generator) File "D:\anaconda\envs\tensorflow\lib\site-packages\keras\utils\data_utils.py", line 644, in get time.sleep(self.wait_time) 有大佬知道怎么解决吗,或者有谁出现了相同的问题吗??
LSTM的格式 与卷积 。。。。。。。。。。。
``` inputs = Input(shape=(28, 140, 1)) s_model = Sequential() s_model.add(LSTM(11, input_shape=(28, 140, 1))) s_model.add(LSTM(11, dropout=0.2, recurrent_dropout=0.2)) x = Conv2D(5, (3, 3), activation='relu')(inputs) s_model.add(x=Conv2D(5, (3, 3), activation='relu')(x)) s_model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy']) s_model.fit(x_train, y_train, batch_size=32, epochs=1) predict_test = s_model.predict(x_test) predict_list = [] ``` 错误: ``` Using TensorFlow backend. WARNING:tensorflow:From D:\Python\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version. Instructions for updating: Colocations handled automatically by placer. 2019-06-18 23:20:57.371797: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 Traceback (most recent call last): File "C:/Users/13544/Documents/yhz-internship/work.py", line 86, in <module> s_model.add(LSTM(11, input_shape=(28, 140, 1))) File "D:\Python\lib\site-packages\keras\engine\sequential.py", line 165, in add layer(x) File "D:\Python\lib\site-packages\keras\layers\recurrent.py", line 532, in __call__ return super(RNN, self).__call__(inputs, **kwargs) File "D:\Python\lib\site-packages\keras\engine\base_layer.py", line 414, in __call__ self.assert_input_compatibility(inputs) File "D:\Python\lib\site-packages\keras\engine\base_layer.py", line 311, in assert_input_compatibility str(K.ndim(x))) ValueError: Input 0 is incompatible with layer lstm_1: expected ndim=3, found ndim=4 4 ```
如何计算mask-rcnn模型的准确率、精确率、召回率?
模型已经训练出来了,用的自己的样本,但不知道怎样测试模型的这三个指标,tensorflow环境,小白一个,刚接触,谢谢!
tensorflow简单的手写数字识别矩阵相乘时出现问题
跟着教程抄的程序为什么运行不了呢 抄下来的程序 ``` #载入数据集 mnist=input_data.read_data_sets("MNIST_data/",one_hot=True) #每个批次大小 batch_size=100 #计算一共有多少批次 n_batch=mnist.train.num_examples//batch_size #定义有两个placeholder x=tf.placeholder(tf.float32,[None,784]) y=tf.placeholder(tf.float32,[None,10]) #创建一个简单的神经网络 W=tf.Variable(tf.zeros([784.10])) b=tf.Variable(tf.zeros([10])) prediction=tf.nn.softmax(tf.matmul(x,W)+b) #二次代价函数 loss=tf.reduce_mean(tf.square(y-perdiction)) #梯度下降法 train_step=tf.train.GradientOptimizer(0.2).minimize(loss) #初始化变量 init=tf.global_variable_initializer() #结果存放在一个布尔型列表中 correct_prediction=tf.equal(tf.argmax(y,1),tf.argmax(prediction,1))#返回一维张量中最大值的位置 #求准确率 accuracy=tf.reduce_mean(tf.cast(correct_prediction,tf.float32)) with tf.Sessio() as sess: sess.run(init) for epoch in range(21): for batch in range(n_batch): batch_xs,batchys=mnist.train.next_batch(batch_size) sess.run(train_step,feed_dict={x:batch_xs,y:batch_ys}) acc=sess.run(accury,feed_dict={x:mnis.test.images,y:mnist.test.labels}) print("Iter"+str(epoch)+",Testing Accuracy"+str(acc)) ``` 给我的警告 ``` Extracting MNIST_data/train-images-idx3-ubyte.gz Extracting MNIST_data/train-labels-idx1-ubyte.gz Extracting MNIST_data/t10k-images-idx3-ubyte.gz Extracting MNIST_data/t10k-labels-idx1-ubyte.gz --------------------------------------------------------------------------- InvalidArgumentError Traceback (most recent call last) C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py in _create_c_op(graph, node_def, inputs, control_inputs) 1658 try: -> 1659 c_op = c_api.TF_FinishOperation(op_desc) 1660 except errors.InvalidArgumentError as e: InvalidArgumentError: Shape must be rank 2 but is rank 1 for 'MatMul_1' (op: 'MatMul') with input shapes: [?,784], [784]. During handling of the above exception, another exception occurred: ValueError Traceback (most recent call last) <ipython-input-5-5e22f4dd85e3> in <module>() 14 W=tf.Variable(tf.zeros([784.10])) 15 b=tf.Variable(tf.zeros([10])) ---> 16 prediction=tf.nn.softmax(tf.matmul(x,W)+b) 17 18 #二次代价函数 C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\ops\math_ops.py in matmul(a, b, transpose_a, transpose_b, adjoint_a, adjoint_b, a_is_sparse, b_is_sparse, name) 2453 else: 2454 return gen_math_ops.mat_mul( -> 2455 a, b, transpose_a=transpose_a, transpose_b=transpose_b, name=name) 2456 2457 C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_math_ops.py in mat_mul(a, b, transpose_a, transpose_b, name) 5627 _, _, _op = _op_def_lib._apply_op_helper( 5628 "MatMul", a=a, b=b, transpose_a=transpose_a, transpose_b=transpose_b, -> 5629 name=name) 5630 _result = _op.outputs[:] 5631 _inputs_flat = _op.inputs C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py in _apply_op_helper(self, op_type_name, name, **keywords) 786 op = g.create_op(op_type_name, inputs, output_types, name=scope, 787 input_types=input_types, attrs=attr_protos, --> 788 op_def=op_def) 789 return output_structure, op_def.is_stateful, op 790 C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py in new_func(*args, **kwargs) 505 'in a future version' if date is None else ('after %s' % date), 506 instructions) --> 507 return func(*args, **kwargs) 508 509 doc = _add_deprecated_arg_notice_to_docstring( C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py in create_op(***failed resolving arguments***) 3298 input_types=input_types, 3299 original_op=self._default_original_op, -> 3300 op_def=op_def) 3301 self._create_op_helper(ret, compute_device=compute_device) 3302 return ret C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py in __init__(self, node_def, g, inputs, output_types, control_inputs, input_types, original_op, op_def) 1821 op_def, inputs, node_def.attr) 1822 self._c_op = _create_c_op(self._graph, node_def, grouped_inputs, -> 1823 control_input_ops) 1824 1825 # Initialize self._outputs. C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py in _create_c_op(graph, node_def, inputs, control_inputs) 1660 except errors.InvalidArgumentError as e: 1661 # Convert to ValueError for backwards compatibility. -> 1662 raise ValueError(str(e)) 1663 1664 return c_op ValueError: Shape must be rank 2 but is rank 1 for 'MatMul_1' (op: 'MatMul') with input shapes: [?,784], [784]. ``` 跪求大佬解答
如何在知道LSTM中偏置和权重情况下,使用tensorflow或者MATLAB中的工具箱来建立LSTM网络
我在使用群智能优化算法对weight和bias进行寻优,得出weights和bias大致范围,但不知如何直接使用这些数值,希望大佬指点
Roman Expressions
Problem Description As any other marketing company, ACM produces a lot of funky advertising items that may contain a logo and be given to customers and business partners as small gifts. A unique specialty of ACM is a calculator that uses roman numbers. Roman numbers are able to express any non-negative integer using uppercase letters: Numbers are created by appending several letters together, the letter representing a higher value must always precede letters with lower values. The only exception are the letters “I”, “X”, and “C”, they may be used before higher letters to form values expressed by digits 4 and 9. The only possible combinations are: Any roman number must first express thousands, then hundreds, tens, and ones. Therefore, 499 must always be written as “CDXCIX”, not “ID”. Although not very practical, this gift is considered extremely “cooooool”. Your task is to write software for that calculator. Input The input will consist from commands, each written on a separate line. Possible commands are assignments, “RESET”, and “QUIT”. An assignment command starts with a single digit representing one of ten registers that the calculator has. The register number is followed by an equal sign (“=”) and an expression. The expression will consist only from valid roman numbers, register names (digits), plus (“+”) and minus (“-”) signs. You may assume that the expression will always be valid and no longer than 10000 characters. Output For each command, output a single line. For assignments, print the register name, equal sign, and the value that is being assigned to that register. Instead of it, print the word “Error”, if the expression contains a reference to a register that has not been assigned before, or if the result is negative or larger than 10000. In such cases, no change to register values is made. For RESET commands, invalidate all previous register assignments and print the word “Ready”. The QUIT command will be the last one. Print the word “Bye” and terminate the program. Sample Input 1=MC+IV-X 1=1+1 RESET 1=1+X 1=MM 1=1+1+1+1+1 2=1+1 QUIT Sample Output 1=MXCIV 1=MMCLXXXVIII Ready Error 1=MM 1=MMMMMMMMMM Error Bye
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、PDF搜索网站推荐 对于大部
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 顺便拉下票,我在参加csdn博客之星竞选,欢迎投票支持,每个QQ或者微信每天都可以投5票,扫二维码即可,http://m234140.nofollow.ax.
Vue + Spring Boot 项目实战(十四):用户认证方案与完善的访问拦截
本篇文章主要讲解 token、session 等用户认证方案的区别并分析常见误区,以及如何通过前后端的配合实现完善的访问拦截,为下一步权限控制的实现打下基础。
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入  假设现有4个人
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 欢迎 改进 留言。 演示地点跳到演示地点 html代码如下`&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;music&lt;/title&gt; &lt;meta charset="utf-8"&gt
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。 1. for - else 什么?不是 if 和 else 才
数据库优化 - SQL优化
前面一篇文章从实例的角度进行数据库优化,通过配置一些参数让数据库性能达到最优。但是一些“不好”的SQL也会导致数据库查询变慢,影响业务流程。本文从SQL角度进行数据库优化,提升SQL运行效率。 判断问题SQL 判断SQL是否有问题时可以通过两个表象进行判断: 系统级别表象 CPU消耗严重 IO等待严重 页面响应时间过长
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 c/c++ 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7
通俗易懂地给女朋友讲:线程池的内部原理
餐厅的约会 餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”我楞了一下,心里想女朋友今天是怎么了,怎么突然问出这么专业的问题,但做为一个专业人士在女朋友面前也不能露怯啊,想了一下便说:“我先给你讲讲我前同事老王的故事吧!” 大龄程序员老王 老王是一个已经北漂十多年的程序员,岁数大了,加班加不动了,升迁也无望,于是拿着手里
经典算法(5)杨辉三角
写在前面: 我是 扬帆向海,这个昵称来源于我的名字以及女朋友的名字。我热爱技术、热爱开源、热爱编程。技术是开源的、知识是共享的。 这博客是对自己学习的一点点总结及记录,如果您对 Java、算法 感兴趣,可以关注我的动态,我们一起学习。 用知识改变命运,让我们的家人过上更好的生活。 目录一、杨辉三角的介绍二、杨辉三角的算法思想三、代码实现1.第一种写法2.第二种写法 一、杨辉三角的介绍 百度
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹
面试官:你连RESTful都不知道我怎么敢要你?
面试官:了解RESTful吗? 我:听说过。 面试官:那什么是RESTful? 我:就是用起来很规范,挺好的 面试官:是RESTful挺好的,还是自我感觉挺好的 我:都挺好的。 面试官:… 把门关上。 我:… 要干嘛?先关上再说。 面试官:我说出去把门关上。 我:what ?,夺门而去 文章目录01 前言02 RESTful的来源03 RESTful6大原则1. C-S架构2. 无状态3.统一的接
SQL-小白最佳入门sql查询一
一 说明 如果是初学者,建议去网上寻找安装Mysql的文章安装,以及使用navicat连接数据库,以后的示例基本是使用mysql数据库管理系统; 二 准备前提 需要建立一张学生表,列分别是id,名称,年龄,学生信息;本示例中文章篇幅原因SQL注释略; 建表语句: CREATE TABLE `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // dosho
漫话:什么是平衡(AVL)树?这应该是把AVL树讲的最好的文章了
这篇文章通过对话的形式,由浅入深带你读懂 AVL 树,看完让你保证理解 AVL 树的各种操作,如果觉得不错,别吝啬你的赞哦。 1、若它的左子树不为空,则左子树上所有的节点值都小于它的根节点值。 2、若它的右子树不为空,则右子树上所有的节点值均大于它的根节点值。 3、它的左右子树也分别可以充当为二叉查找树。 例如: 例如,我现在想要查找数值为14的节点。由于二叉查找树的特性,我们可...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,
程序员:我终于知道post和get的区别
IT界知名的程序员曾说:对于那些月薪三万以下,自称IT工程师的码农们,其实我们从来没有把他们归为我们IT工程师的队伍。他们虽然总是以IT工程师自居,但只是他们一厢情愿罢了。 此话一出,不知激起了多少(码农)程序员的愤怒,却又无可奈何,于是码农问程序员。 码农:你知道get和post请求到底有什么区别? 程序员:你看这篇就知道了。 码农:你月薪三万了? 程序员:嗯。 码农:你是怎么做到的? 程序员:
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU
开源并不是你认为的那些事
点击上方蓝字 关注我们开源之道导读所以 ————想要理清开源是什么?先要厘清开源不是什么,名正言顺是句中国的古代成语,概念本身的理解非常之重要。大部分生物多样性的起源,...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
      11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1
程序员把地府后台管理系统做出来了,还有3.0版本!12月7号最新消息:已在开发中有github地址
第一幕:缘起 听说阎王爷要做个生死簿后台管理系统,我们派去了一个程序员…… 996程序员做的梦: 第一场:团队招募 为了应对地府管理危机,阎王打算找“人”开发一套地府后台管理系统,于是就在地府总经办群中发了项目需求。 话说还是中国电信的信号好,地府都是满格,哈哈!!! 经常会有外行朋友问:看某网站做的不错,功能也简单,你帮忙做一下? 而这次,面对这样的需求,这个程序员
网易云6亿用户音乐推荐算法
网易云音乐是音乐爱好者的集聚地,云音乐推荐系统致力于通过 AI 算法的落地,实现用户千人千面的个性化推荐,为用户带来不一样的听歌体验。 本次分享重点介绍 AI 算法在音乐推荐中的应用实践,以及在算法落地过程中遇到的挑战和解决方案。 将从如下两个部分展开: AI 算法在音乐推荐中的应用 音乐场景下的 AI 思考 从 2013 年 4 月正式上线至今,网易云音乐平台持续提供着:乐屏社区、UGC
【技巧总结】位运算装逼指南
位算法的效率有多快我就不说,不信你可以去用 10 亿个数据模拟一下,今天给大家讲一讲位运算的一些经典例子。不过,最重要的不是看懂了这些例子就好,而是要在以后多去运用位运算这些技巧,当然,采用位运算,也是可以装逼的,不信,你往下看。我会从最简单的讲起,一道比一道难度递增,不过居然是讲技巧,那么也不会太难,相信你分分钟看懂。 判断奇偶数 判断一个数是基于还是偶数,相信很多人都做过,一般的做法的代码如下
《C++ Primer》学习笔记(六):C++模块设计——函数
专栏C++学习笔记 《C++ Primer》学习笔记/习题答案 总目录 https://blog.csdn.net/TeFuirnever/article/details/100700212 —————————————————————————————————————————————————————— 《C++ Primer》习题参考答案:第6章 - C++模块设计——函数 文章目录专栏C+...
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
面试官如何考察你的思维方式?
1.两种思维方式在求职面试中,经常会考察这种问题:北京有多少量特斯拉汽车? 某胡同口的煎饼摊一年能卖出多少个煎饼? 深圳有多少个产品经理? 一辆公交车里能装下多少个乒乓球? 一
so easy! 10行代码写个"狗屁不通"文章生成器
前几天,GitHub 有个开源项目特别火,只要输入标题就可以生成一篇长长的文章。背后实现代码一定很复杂吧,里面一定有很多高深莫测的机器学习等复杂算法不过,当我看了源代码之后这程序不到50
知乎高赞:中国有什么拿得出手的开源软件产品?(整理自本人原创回答)
知乎高赞:中国有什么拿得出手的开源软件产品? 在知乎上,有个问题问“中国有什么拿得出手的开源软件产品(在 GitHub 等社区受欢迎度较好的)?” 事实上,还不少呢~ 本人于2019.7.6进行了较为全面的 回答 - Bravo Yeung,获得该问题下回答中得最高赞(236赞和1枚专业勋章),对这些受欢迎的 Github 开源项目分类整理如下: 分布式计算、云平台相关工具类 1.SkyWalk
相关热词 c# clr dll c# 如何orm c# 固定大小的字符数组 c#框架设计 c# 删除数据库 c# 中文文字 图片转 c# 成员属性 接口 c#如何将程序封装 16进制负数转换 c# c#练手项目
立即提问

相似问题

1
怎么对机器学习后的的acc和epoch进行绘图啊
0
罗马字符的替换操作问题是怎么做的?采用C编程的语言
1
tensorflow简单的手写数字识别矩阵相乘时出现问题
0
用罗马数字构成的表达式的计算问题,怎么采用C语言程序的设计的思路来实现
1
Python Tensorflow中dense问题
0
如何用AUC值评价logistics模型和ANN模型?
1
国内镜像anaconda入口进不去了,如何高速下载相关内容
1
Anaconda navigator打开的时候没有反应?更新的时候报错
1
【线性代数】向量叉乘得到向量/向量相乘得到矩阵,两种有什么区别
3
用java程序调用python,tensorflow模型便不能由python程序读入了
1
请问哪位大佬有tensorflow-1.12.0-cp27-none-linux_armv7l.whl呀?我这边下载不了
2
求mnist多数字识别,修改完成我的代码
2
LSTM的格式 与卷积 。。。。。。。。。。。
0
用TensorFlow和opencv实现ssd目标检测的时候调不出摄像头
0
罗马数字和阿拉伯的数组的一个转换的问题,怎么用C语言的程序的代码编写实现字符的判断和转换的
1
神经网络按梯度下降训练,不应该用同一个样本迭代直到得到loss最小值?然后再继续下一个样本吗?
1
使用tensorflow的API dataset遇到memoryerror
2
如何防止过拟合?为何我的训练准确率高,但是测试准确率很低?
1
我的keras的model.fit写在一个loop里,callback每一个epoch会生成一个events文件,如何处理这种问题?
0
罗马的数字的一个转换,C语言的程序的编写,谢谢