Code Monkey home page Code Monkey logo

classification-pytorch's Introduction

Hi,很高兴遇见你 👋

classification-pytorch's People

Contributors

bubbliiiing avatar

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

classification-pytorch's Issues

输入图像对于所有类别的属于可能性的问题

比如说输入img/cat.jpg的时候,预测结果是Class: cat Probability: 0.998,希望可以得到的预测结果是Class: cat Probability: 0.998,dog Probability: 0.002。

#---------------------------------------------------#

获得所属种类

#---------------------------------------------------#
class_name = self.class_names[np.argmax(preds)]
probability = np.max(preds)

我觉得应该是需要修改这块的代码,但是不知道该如何下手...初学者还请多多包涵~
如果能回复我,将不胜感激~~~支持大佬!!!

运行eval.py出现错误:ValueError: Axis limits cannot be NaN or Inf

不知道怎么解决,不知道哪里出了问题。具体的提示是:
RuntimeWarning: invalid value encountered in true_divide
F1 = (2 * Recall * Precision) / (Recall + Precision)
Save Recall out to metrics_out\Recall.png
Save Precision out to metrics_out\Precision.png
Traceback (most recent call last):
File "F:\ImgClassification\eval.py", line 58, in
top1, top5, Recall, Precision, F1= evaluteTop1_5(classfication, lines, metrics_out_path)

Vit预训练权重

出错信息:

There is no pretrained model for vit_b_16
Traceback (most recent call last):
  File "train.py", line 225, in <module>
    model = get_model_from_name[backbone](input_shape = input_shape, num_classes = num_classes, pretrained = pretrained)
  File "/data/xly/hhs/classification-pytorch-1/nets/vision_transformer.py", line 223, in vit_b_16
    model.load_state_dict(torch.load("/data/xly/hhs/classification-pytorch-1/model_data/vit-patch_16.pth"))
  File "/root/anaconda3/envs/torch38/lib/python3.8/site-packages/torch/serialization.py", line 595, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/root/anaconda3/envs/torch38/lib/python3.8/site-packages/torch/serialization.py", line 749, in _legacy_load
    return legacy_load(f)
  File "/root/anaconda3/envs/torch38/lib/python3.8/site-packages/torch/serialization.py", line 674, in legacy_load
    tar.extract('storages', path=tmpdir)
  File "/root/anaconda3/envs/torch38/lib/python3.8/tarfile.py", line 2272, in extract
    tarinfo = self._get_extract_tarinfo(member, filter_function, path)
  File "/root/anaconda3/envs/torch38/lib/python3.8/tarfile.py", line 2279, in _get_extract_tarinfo
    tarinfo = self.getmember(member)
  File "/root/anaconda3/envs/torch38/lib/python3.8/tarfile.py", line 1962, in getmember
    raise KeyError("filename %r not found" % name)
KeyError: "filename 'storages' not found"

权重文件:
image
环境:
Ubuntu 20.04
其余配置和项目中的requirements一样
image
就是权重文件损坏了吗?

关于resnet50在不同torchvision下的不同权重问题

https://download.pytorch.org/models/resnet50-19c8e357.pt
https://download.pytorch.org/models/resnet50-0676ba61.pth
我想问下这俩权重为啥不一样,我找到torchvision下的resnet.py文件。发现他们定义的网络结构一样的。为啥加载模型会不一样呢。
要是加载不对应的权重会报错:
RuntimeError: Error(s) in loading state_dict for ResNet:
size mismatch for layer1.0.downsample.1.weight: copying a param with shape torch.Size([256, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([256]).
size mismatch for layer2.0.downsample.1.weight: copying a param with shape torch.Size([512, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([512]).
size mismatch for layer3.0.downsample.1.weight: copying a param with shape torch.Size([1024, 512, 1, 1]) from checkpoint, the shape in current model is torch.Size([1024]).
size mismatch for layer4.0.downsample.1.weight: copying a param with shape torch.Size([2048, 1024, 1, 1]) from checkpoint, the shape in current model is torch.Size([2048]).
求大佬指导。

BUS ERROR

你好,在服务器上运行代码中出现bus error,请问是什么错误
image

关于DataGenerator的问题

您好,我想问一下,这下面的两个参数True和False是代表DataGenerator类中的ramdom的值吗?
也就是autoagument一直是默认值True
9372940FB7D066844E577AEE62524E11
D0C57D01BEF10340A466E3BC5A83BDF3

模型参数大小的问题

您好,训练出来的ResNet50 的pth大小为92161kb;
但是作者原文中写的25.6M,这是什么原因呀?
image

大佬,我在Ubuntu上跑训练的时候报这个错误一直找不到解决方法能帮我看看吗

Traceback (most recent call last): File "train.py", line 452, in
fit_one_epoch(model_train, model, loss_history, optimizer, epoch, epoch_step, epoch_step_val, gen, gen_val, UnFreeze_Epoch, Cuda, fp16, save_period, save_dir, local_rank)
File "/mnt/class_master/utils/utils_fit.py", line 116, in fit_one_epoch if (math.floor(epoch) + 1) % save_period == 0 or math.floor(epoch)+1 == Epoch:
TypeError: unsupported operand type(s) for %: 'int' and 'str'

数据预处理方式

代码中的数据预处理是resie到 [224,224],之后CenterCrop [224,244],CenterCrop前后图像大小一样是不是意味着CenterCrop不起作用?我看很多其他仓库的代码是训练时候直接Randcrop到 [224,224],而在预测或评估时先resize到 [256,256] 再CenterCrop到 [224,224],想请问一下这个问题。
另外,仓库中的归一化方式是除以127.5,之后-1,把所有像素点归纳到 [-1,1]之间,而其他仓库是除以255,之后用imagenet1K数据集的mean和std作normalize,官方论文中是用哪种方式呢?

迭代到50之后就停止了

代码在训练到50个epoch之后就停止了
Uploading 图片.png…
报错是
`Total Loss: 0.733 || Val Loss: 0.695
Epoch 51/100: 0%| | 0/18 [00:00<?, ?it/s<class 'dict'>]Start Train

Process finished with exit code -1073741819 (0xC0000005)`
请问这是什么原因呢?

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.