Skip to content

PyTorch

[PyTorch] Set the threshold of Sigmoid output and convert it to binary value

When using sigmoid function in PyTorch as our activation function, for example it is connected to the last layer of the model as the output of binary classification. After all, sigmoid can compress the value between 0-1, we only need to set a threshold, for example 0.5 and you can divide the value into two categories.

Read More »[PyTorch] Set the threshold of Sigmoid output and convert it to binary value

[PyTorch] Convert Tensor to One-Hot Encoding Type

Today if you are preprocessing some machine learning data, maybe you need to convert PyTorch tensor to one-hot encoding type. There is a intuitive method that is convert TENSOR to NUMPY-ARRAY, and then convert NUMPY-ARRAY to one-hot encoding type, just like this article: [Python] Convert the value to one-hot type in Numpy

Read More »[PyTorch] Convert Tensor to One-Hot Encoding Type

[PyTorch] Tutorial(7) Use Deep Generative Adversarial Network (DCGAN) to generate pictures

Today I want to record how to use Deep generative Adversarial Network (DCGAN) to implement a simple generate picture model. I wanted to demo with delicious snack pictures, but the effect was not very good, I downloaded half a million snack pictures in vain.

Finally, I used the official demo CelebA dataset.

Read More »[PyTorch] Tutorial(7) Use Deep Generative Adversarial Network (DCGAN) to generate pictures

[PyTorch] Tutorial(5) How to train a model to classify CIFAR-10 database

Today we challenged the classifiers of different data sets again. This time, CIFAR-19 is a more difficult problem than MNIST handwriting recognition. In addition to the size of the picture becoming 32×32, CIFAR-10 is no longer a pure grayscale value, but a picture with the three primary colors of RGB.

Read More »[PyTorch] Tutorial(5) How to train a model to classify CIFAR-10 database