[] PyTorch use pytorch provide model training inception V3 (using pre-trained model)

Preface:

In recent run data vgg16, but the parameters of the amount is too great, running very slow, although the final results are fairly impressive. Followed by another study a little GoogLeNet, write their own code inceptionV1, because the computer ran vgg16 been occupied, so we did not run.

During this period, little brother on the computer ran MobileNet V1, can not find the right pytorch pre-training version of the heavy, so to start from scratch to run, over-fitting is very serious, look after and so what is the reason, speculation is too unbalanced datasets serious and no pre-training.

Today we called directly run the code data of pytorch inception V3, and for this network has not been studied in depth, so when it came to run some of the more low-level problem, but also not search on Baidu, finally found a solution on Google .

problem:

'InceptionOuputs' object has no attribute 'log_softmax'

In the error Torch 0.4.0 should be reported:

'tuple' object has no attribute 'log_softmax'

Solution:

inception series has an auxiliary classifier in training when you can choose whether to use the auxiliary classifier, I chose to use the time in training, so the output of the network are:

       if self.training and self.aux_logits:
           return _InceptionOuputs(x, aux)

And_InceptionOuputsIt is defined as the top of the code:

_InceptionOuputs = namedtuple('InceptionOuputs', ['logits', 'aux_logits'])

The return value is a tuple type, but in the train.py

outputs = model(inputs)

The return value is assigned to only one value, so in this caseoutputsIs atupleType value, and thenoutputsInput to function calculates the loss function to go and they will report the above error.

But why is version 0.4.0, when reported errors are not the same?

This is because the modified version of the code to return the output of the network is so written:

        if self.training and self.aux_logits:
            return x, aux

Simply not defined_InceptionOuputs!

But the search in Google are also'tuple' object has no attribute 'log_softmax'The solution to this problem, about the new version of the problem has not yet seen.

 

Intelligent Recommendation

Image classification using the pre-training model in Pytorch

PytorchTorchVision moduleInclude multiple pre-training models for image classification,TorchVisionCapacus consists of a popular data set, a model structure, and a general image conversion function for...

Use the pre-trained model to initialize some of the parameters of the network in PyTorch

On the basis of the pre-trained network, modify some layers to get our own network. Usually, the problems we need to solve include: 1. Load parameters from the pre-trained model 2. Set different learn...

Pytorch use notes 2-call and modify the pre-trained model

In this experiment, the resnet50 model was called. Since the original input of the model is 3 channels, but I only need 1 channel, I need to modify the number of input channels. In addition, you need ...

5. Use PyTorch pre -trained model to perform target detection

5. Use PyTorch pre -trained network execution target detection This blog will introduce how to detect the network execution target using PyTorch pre-trained network. These networks are pioneering and ...

Installation and use of Pytorch official pre-training model

Official pre-training model related to TorchVision package Import pre-training model statement If the model information has not been downloaded, it will be downloaded automatically, but the method wil...

More Recommendation

Use of BERT pre -training model (PyTorch)

Use the word splitter to encode: ENCODE returns only input_ids ENCODE_PLUS returns all coding information Input_ids: The encoding of the word in the dictionary Token_type_ids: Differential encoding of...

pytorch load some parameters pre-trained model

Sometimes the network structure model with pre-training model we built are not the same, in order to pre-training model and our model overlap partially loaded in, we need to use methods to load some p...

PyTorch loads pre-trained model (vgg16_bn)

PyTorch loads pre-trained models Recently I want to load the official pre-trained model of torchvision on my reproducible VGGvgg16_bn-6c64b313.pthHowever, it is found that the parameter names do not c...

Pytorch loads some pre-trained model parameters

Foreword Since the deep learning framework caffe was transferred to Pytorch, I feel that the advantages of Pytorch are wonderful. The various designs are simple, easy to study the network structure mo...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top