Coder Social home page Coder Social logo

yijinhuang / pytorch-classification Goto Github PK

View Code? Open in Web Editor NEW
55.0 2.0 18.0 159 KB

A general, feasible, and extensible framework for classification tasks.

License: MIT License

Python 100.00%
classification imbalance-classification imbalanced-data medical-image-analysis

pytorch-classification's People

Contributors

yijinhuang 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

Watchers

 avatar  avatar

pytorch-classification's Issues

关于多卡训练无法复现的疑问

您好,我是北航的一名研究生,非常感谢您在eyepacs上的调参训练结果。

根据您的环境要求,我配置了相同版本的环境。单卡训练时,我发现实验结果是可以复现的。但是我在多卡训练时遇到了一些问题,根据您的设置,random_seed=1,cudnn_deterministic=true,但是实验结果无法复现。可能我错误使用了您的代码,但我没能找到具体的原因,非常抱歉打扰您,能请您帮忙分析一下吗,十分感谢!

祝您安好!

Still got "AttributeError" after copying the Python script containing the "ContrastiveModel" class to the same folder as "main.py".

%%%

  1. The "AttributeError" is caused by the pickle mechanism, which means you need to copy the Python script containing the "ContrastiveModel" class to the same folder as "main.py".

%%%

Originally posted by @YijinHuang in #10 (comment)

I still got the same attribute error after doing so. Are there any further detailed instructions about how can I train the classification model to evaluate the weights from Lesion-based-Contrastive-Learning? Or are there any other parts I have to modify in the script?

Thanks for the help!

圖片_2024-06-28_021402767

Evaluation of pretrained models in Lesion-based CL

Hi, I'm really interested in your work, however, I came across some issue while using this repository for evaluation on pre-trained models in Lesion-based CL. In the instruction of how to reproduce the experimental results on diabetic retinopathy grading, it said that: "To fine-tune pretrained models, treat the pretrained weights as checkpoints by updating the item "checkpoint" in ~/configs/eyepacs.yaml."
My understanding is that I just have to modify the "checkpoint" item in ~/configs/eyepacs.yaml like this:

checkpoint: /root/Work/Retina_Seg/pytorch-classification/configs/final_model.pt # load weights from other pretrained model

After I trained the Lesion-based CL model, save the training weights and updated the "checkpoint" item in ~/configs/eyepacs.yaml , I run 'main.py', the error message occurred:

AttributeError: Can't get attribute 'ContrastiveModel' on <module 'modules' (<_frozen_importlib_external.NamespaceLoader object at 0x7f85f1d342d0>)>

Also, I changed the pretrained model to the one you provided (ie.resnet50_128_07.pt) and it shows:
RuntimeError: Error(s) in loading state_dict for ResNet:
Missing key(s) in state_dict: "fc.weight", "fc.bias".

I'm thinking how to resolve the error or are there any other step I have missed to evaluate the pre-trained models in Lesion-based CL?
Any help is appreciated!

关于您代码中优化器的一点小疑问。

您好!
又来向您请教问题了,最近又在您的代码上调参数,发现了一件很奇怪的现象。您默认使用的是SGD+nesterov方法,看您的代码也写了ADAM优化器,不知道为什么我把优化器换成ADAM之后,效果非常差,直接无法正常工作。 kappa指标一直为0,acc也保持不变,想来全预测为类别0了,如图所示,请问您碰到了这个情况吗?

微信图片_20220613154349
祝您安好!

关于未能复现您Resnet50在Eyepacs上的结果的一些疑问。

image

您好,我是电子科大的一名研究生,最近也在做糖尿病视网膜病变分级的研究,很兴奋看到您在Resnet50上通过调参达到很好的效果,给后续研究者一个非常高的起点,非常感谢你。

可是在复现您代码的时候遇到了一些问题,结果如上图,那是训练的过程图。
我按照您的数据预处理方法,运行crop.py对图像进行裁切。
配置也是按照您的eyepacs配置的,仅仅改了路径。
唯一的不同点在于我的验证集是从训练集里面划分的,我的训练集,验证集,测试集 分别是 28090 7027 53570,但这个应该不影响。

疑问:为什么训练过程中的Accuracy会这么低呢? 验证集的kappa也并不高。 我自己使用普通Resnet50,训练集Acc大概90% ,验证集Acc大概84% , kappa能有77%左右。 可能是我使用对您的代码使用的不对,但是我没找到具体原因,所以冒昧打扰您,请您帮忙分析一下,非常感谢您啦。
祝您安好!

Unable to import torcheval.metrics

I am currently trying to run the main.py file, however I am unable to do so because I get the following error: RuntimeError: 'Tensor' object has no attribute or method 'new_ones'.

This stems from the torcheval.metrics import. Importing torcheval works just fine, and I do have all packages installed according to the requirements file.

Please could you advise?

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.