Torch in PyTorch Use of Optim optimizer

1, Basic usage of optimizer Create optimizer instanceCycle: Empty gradientForward propagationCalculate LossBack propagationUpdate parameters Example: from torch import optim input = ..... optimizer = optim.SGD(params=net.parameters(), lr=1) # Optimizer instance optimizer.zero_grad() # Empty gradient output = net(input) # Forward propag ...

Posted by ir4z0r on Wed, 05 Jan 2022 09:14:29 +0100

Image processing

Requirements: There is a position size picture. Now you need to get a picture of the specified size according to the original picture, and the obtained picture should conform to the proportion of the original picture, that is, after the picture is obtained by equal scaling on the basis of the original picture, you can cut it, so as to ensure t ...

Posted by gfmitchell on Wed, 05 Jan 2022 08:55:13 +0100

Chexnet cam: visualization of CT image pneumonia detection

introduce Not long ago (in fact, for a long time), the CheXNet model for CT image detection of pneumonia was reproduced with Paddle A visual method CAM is mentioned in the paper, which can visualize the activation of the network. The example is shown in the figure below: [the external chain picture transfer fails. The source station may have ...

Posted by simun on Wed, 05 Jan 2022 05:28:57 +0100

onnx model deployment ONNXRuntime

Generally, we can use many different frameworks when training models. For example, some students like to use pytoch, some students like to use tensorflow, some students like MXNet, and Caffe, which is popular at the beginning of deep learning. In this way, different training frameworks lead to different model result packages, Different dependen ...

Posted by tefuzz on Tue, 04 Jan 2022 20:45:12 +0100

Artificial intelligence -- Text Mining Based on LSTM

Learning objectives: Understand the basic principles of text mining.Master the method of text classification using LSTM. Learning content: In recent years, with wechat, microblog, mayor's mailbox, sunshine hotline and other online political platforms gradually becoming an important channel for the government to understand public opinion, gat ...

Posted by aquilina on Tue, 04 Jan 2022 19:31:05 +0100

Code implementation of calculating the similarity between tensor s according to Euclidean distance and cosine similarity

Generally, in the process of model reasoning on the end side, the quantized data is used to participate in the calculation of each layer, rather than the original float data type. The usual quantized data types include UINT8/INT8/INT16, etc. due to the difference of data representation range, the accuracy loss must be involved in the quantizati ...

Posted by lihman on Tue, 04 Jan 2022 17:23:25 +0100

Source code analysis of Cosine similarity and Euclidean distance in Python framework

1, The matrix operation is used to calculate cosine similarity Cosine similarity: We know that the numerator is the multiplication of a matrix and the denominator is the product of two scalars. Denominator easy to do, the key is how to calculate the numerator? Very simply, we can deform the formula: Then we just need to normalize the mat ...

Posted by zcollvee on Tue, 04 Jan 2022 17:19:44 +0100

(TVM development code learning) familiar with the code of Relay operator

This article is the last article (TVM development code learning) add a new operator to the Relay system - Zhihu (zhihu.com) It is mainly to be familiar with the Relay operator code from six parts and deconstruct the Relay operator in TVM from the perspective of adding an operator. Reviewing the previous section, the following points are requir ...

Posted by tawevolution on Tue, 04 Jan 2022 16:37:12 +0100

[source code analysis] machine learning parameter server PS Lite ----- application node implementation

[source code analysis] machine learning parameter server PS Lite (4) -- application node implementation 0x00 summary This is the fourth article on parameter server, which introduces kvworker and kvserver. Other articles in this series are: [ Source code analysis] machine learning parameter server PS Lite (1) -- postoffice [ Source code ...

Posted by M4F on Tue, 04 Jan 2022 09:24:14 +0100

Q-learning(DQN): the swing of reinforcement learning

1. Project introduction Q-learning: Q-learning was first proposed in 1989 and was initially based on tabular form. DQN: DQN (deep Q network) was proposed only in 2013. It is a Q-learning algorithm based on deep neural network, and it is also the most commonly used Q-learning algorithm at present. Objectives of the project: The DQN algorithm ...

Posted by vigge89 on Tue, 04 Jan 2022 02:42:09 +0100