Category：Python

Time：202041
Tensorflow is based on static graph mode, which makes it difficult to debug when writing code. In addition to using official debugging tools, the most direct way is to output the intermediate results for viewing. However, directly using print function can only output the shape of the sensor variable, not the value. If you want […]

Time：202041
1、 Download TTF format for fonts Link: https://pan.baidu.com/s/1jwjq_2vqkg8etkcw3wExtraction code: nk56 Msyh.ttf Microsoft YaHei font 2、 Move fonts to font system directory /usr/share/fonts/ 3、 Installation related instructions yum install y fontconfig mkfontscale 4、 Install fonts cd /usr/share/fonts/ mkfontscale mkfontdir fccache

Time：2020331
Numpy. Sort() function This function provides a variety of sorting functions, and supports a variety of sorting algorithms such as merge sort, heap sort, fast sort, etcThe format of using the numpy. Sort() method is: numpy.sort(a,axis,kind,order) a: Array to sort Axis: along the sorting axis, axis = 0 is sorted by column, axis = 1 […]

Time：2020331
1. Hashlib password hash The hashlib module defines an API to access different cryptographic hashing algorithms. To use a specific hash algorithm, create a hash object with the appropriate constructor function or new(). No matter which specific algorithm is used, these objects use the same API. 1.1 hash algorithm Because hashlib has OpenSSL to provide […]

Time：2020330
In test.py, you can directly generate a Pb file with weight through the following code, or you can convert CKPT to a Pb file through TF’s official free graph.py. constant_graph = graph_util.convert_variables_to_constants(sess, sess.graph_def,[‘net_loss/inference/encode/conv_output/conv_output’]) with tf.gfile.FastGFile(‘net_model.pb’, mode=’wb’) as f: f.write(constant_graph.SerializeToString()) In tf1.0, the output of each layer can be obtained through the Pb file with weight […]

Time：2020330
Reference: the author’s jupyter notebook Chapter 5 – Support Vector Machines Support vector machine (SVM) is a powerful and comprehensive machine learning model, which can perform linear or nonlinear classification, regression, and even outlier detection tasks. It is one of the most popular models in machine learning. Anyone who is interested in machine learning should […]

Time：2020329
Numpy. Amin() and numpy. Amax() Numpy. Amin() is used to calculate the minimum value of the elements in the array along the specified axis. Numpy. Amax() is used to calculate the maximum value of elements in an array along the specified axis a=np.array([1,3,6],[3,4,11],[6,1,4]) Print (NP. Amin (a, 1) minimum value of each line Print […]

Time：2020329
1. Preface We have explained fixed length objects in detail in the [integer objects in Python] Chapter. Next, we will introduce variable length objects, and string type is a typical representative of such objects. A concept must be introduced here: Variable length objects in Python fall into two categories： Variable length variable object – for […]

Time：2020328
1. multiple curves 1.1 use pyplot mode import numpy as np import matplotlib.pyplot as plt x = np.arange(1, 11, 1) plt.plot(x, x * 2, label=”First”) plt.plot(x, x * 3, label=”Second”) plt.plot(x, x * 4, label=”Third”) Plt.legend (LOC = 0, ncol = 1) ා parameter: LOC sets the display position, 0 is adaptive; ncol sets the […]

Time：2020327
1. Try… Except… To avoid import errors due to different versions try: image_summary = tf.image_summary scalar_summary = tf.scalar_summary histogram_summary = tf.histogram_summary merge_summary = tf.merge_summary SummaryWriter = tf.train.SummaryWriter except: image_summary = tf.summary.image scalar_summary = tf.summary.scalar histogram_summary = tf.summary.histogram merge_summary = tf.summary.merge SummaryWriter = tf.summary.FileWriter 2. Write code to scope (scope does not affect code operation) with […]

Time：2020326
When doing network training experiments, sometimes it is necessary to display the training curve and test curve together, so as to observe the effect of network training. After many times of stepping on the pit, it was finally solved. The specific method is to set two writers, one for writing training data and the other […]

Time：2020325
This article mainly introduces the implementation method of Python underlying encapsulation. The example code is introduced in detail in this article, which has a certain reference value for your study or work. You can refer to the following for your friends In fact, the implementation of Python encapsulation features is purely “opportunistic”. The reason why […]