Coder Social home page Coder Social logo

hrnet / hrnet-image-classification Goto Github PK

View Code? Open in Web Editor NEW
953.0 953.0 216.0 188 KB

Train the HRNet model on ImageNet

Home Page: https://jingdongwang2017.github.io/Projects/HRNet/

License: MIT License

Python 100.00%
high-resolution-net hrnets image-classification imagenet

hrnet-image-classification's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hrnet-image-classification's Issues

Training Custom Dataset

I have been trying to find the format in which I can train RPC Dataset with the HR-Net and do evaluation. It is COCO format. I am unable to use it in Tensor or Pytorch version of the code. The only support that is given is for Imagenet and that too doesnt help.

how to get class label values & confusion matrix at test ? its not sufficient to get only accuracy..!

I try with "HRNet-Image-Classification/lib/core/function

function.txt

.py" in this file, at line no. 104,

for i, (input, target) in enumerate(val_loader):
            output = model(input)
            batch_time.update(time.time() - end)
            target = target.cuda(non_blocking=True)
            loss = criterion(output, target)

in this I try with target variable, it shows correct values at train time, but at test time it shows the class label for image in which its stored. not accurate values. can anyone tell how to get class label values for "test.py" ? target variable shows inaccurate values at testing.

How to use get_cls_net?

Thanks writing codes.
If I want to directly use the function (get_cls_net) .
How can I define the parameters of config? It is not easy for me to assign variable config to HighResolutionNet.

Can you please optimize code?

As I was reading throught the code, I found there's a lot of confusion and unnecessary complication. Can you please simplify?

How to train on single GPU

For I don't have multi-GPUS, I changed the GPUS = (0,0,0,0), but this error came RuntimeError: inputs must be on unique devices. There is no doubt telling that this network working on more than one GPUS. So how do I change the code to run them on single GPU?

Begging for training log.

I modify the network structure and train from scratch.Can I get your training log and compare it?

BRANCHES instead of RANCHES

In cls_hrnet_w18_small_v2_sgd_lr5e-2_wd1e-4_bs32_x100.yaml STAGE1 configuration should read NUM_BRANCHES instead of NUM_RANCHES. In fact this doesn't affect in anything the code since .make_stage instead called for stage1; however, just to be consistent it be good to change it.

new pretrained model "HRNet-W48-C (w/ CosineLR + CutMix + 300epochs)"

Hello. Thank you for offering newly added checkpoints! When I tried to use the one "HRNet-W48-C (w/ CosineLR + CutMix + 300epochs)", my pytorch model loader and tar extractor couldn't work. Could you please release another version, or tell me the correct way to use it? Thanks!

Could someone help to put the pretrained models in google drive?

I am interested in the following models:
HRNETV2_W18: "./pretrained_models/hrnetv2_w18_imagenet_pretrained.pth"
HRNETV2_W32: "./pretrained_models/hrnetv2_w32_imagenet_pretrained.pth"
HRNETV2_W48: "./pretrained_models/hrnetv2_w48_imagenet_pretrained.pth"

I am not able to download them from baidu. I wonder if someone can help to put them in google drive.
Many thanks.

Torch.jit.script not working with this model

I have tried to convert this model to TorchScript using torch.jit.script. However, I am getting this issue:

RuntimeError: 
Expected integer literal for index:
  File "/home/david/Documents/pry/models/archs/hrnet.py", line 228

        for i in range(self.num_branches):
            x[i] = self.branches[i](x[i])
                   ~~~~~~~~~~~~~~~ <--- HERE

        x_fuse = []

How to convert the pretrained cls model to the required model for pose estimation

Thanks for such a great work.

I trained HRNet-W32-C in imagenet, got the pretrained cls model (final_state.pth.tar) which has 1956 keys.

However, the pretrained model (hrnet_w32-36af842e.pth) provided by pose_hrnet_w32 [https://github.com/leoxiaobin/deep-high-resolution-net.pytorch] has 2000 keys.

I compared the keys of them, the classification pretraining lacks some keys, what should I do? Looking forward to your reply.

guide to use pre-trained model

Hello. I am a beginner in deep learning and pytorch, and I have a question about how to use HRNet.

I downloaded the pre-trained model you provided (HRNet-W64-C) from one-drive and cloned the HRNet repo and opened it in pycharm.

In this state, I would like to test the image using the model I downloaded.

If you have a detailed explanation on how to do this, I would like to ask you a link, if not, for beginners.

A solution: HRNet Backbone Adopt_different_blocks_bug(BASIC//BOTTLENECK)

https://github.com/HRNet/HRNet-Image-Classification/blob/8f158719e821836e21e6cba99a3241a12a13bc41/lib/models/cls_hrnet.py#L459~L473
If different block types are used in different stages, instead of the default bottleneck-basic-basic-basic in the original yaml file, the channel mismatch error as shown in the figure below will appear. To avoid this error, we change it in the transition layer and use conv3*3 between different stages to match the number of channels. The corrected code and results are shown in the figure below.
(The demonstration is only a proof of feasibility, not an actual demonstration of the code)

how can i modify the inputsize?

hi! if i want to modify the inputsize of HRNet-samll-v1 from 224 to 84, Which parameters of the network need to be modified? can u give me some advice? thanks!

How To Perform Inference

I’ve been able to train my model, and perform validation, however, I cannot find a way to do inference. Even in validation, while it tells me the percentage it got wrong, I could not find any file or log that tells me which ones it got wrong. I’ve searched through the entire repo, and haven’t found a way to perform inference.

With that, I would like to ask the obvious question of how to perform inference and use the model.

Convert to output multi label

Hi

Thanks for sharing your work, Could you please give guidance to convert this model to train a multi label classification, ie; Single image multiple outputs

Thanks in advance

about self.class_weights

HI! from ~\lib\datasets\cityscapes.py
i can see:
self.class_weights = torch.FloatTensor([0.8373, 0.918, 0.866, 1.0345,
1.0166, 0.9969, 0.9754, 1.0489,
0.8786, 1.0023, 0.9539, 0.9843,
1.1116, 0.9037, 1.0865, 1.0955,
1.0865, 1.1529, 1.0507]).cuda()

What do you mean?

the loss become nan

when i was trying to recurrence the face-xray, I modified the HRNet-Image-Calssification, but I got a bug that loss is nan.
this is what i added after stage4 in the cls_hrnet.py:

        # Upsampling
        x0_h, x0_w = y_list[0].size(2), y_list[0].size(3)
        x1 = F.interpolate(y_list[1], size=(x0_h, x0_w), mode='bilinear',align_corners=True)
        x2 = F.interpolate(y_list[2], size=(x0_h, x0_w), mode='bilinear',align_corners=True)
        x3 = F.interpolate(y_list[3], size=(x0_h, x0_w), mode='bilinear',align_corners=True)

        x = torch.cat([y_list[0], x1, x2, x3], 1)
        x = self.one_conv2d(x) # one conv2d to make the channel to 1
       
        x = F.interpolate(x, size=(224,224),mode='bilinear',align_corners=True)
        xray = torch.sigmoid(x)

then I found the xray is almost zero and the loss is nan, what's wrong?

I write the loss function below:

    def criterion(pred,target):
        x = torch.add(torch.mul(target,torch.log(pred)),torch.mul(torch.sub(1,target),torch.log(torch.sub(1,pred))))
        loss = -torch.mean(x)
        return loss

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.