Giter VIP home page Giter VIP logo

Comments (5)

BestJuly avatar BestJuly commented on September 28, 2024

@Mrbishuai 抱歉回复晚了
我不清楚是否在使用过程中的参数赋值出现了问题,从代码上讲,如果--neg的赋值不同,对应到训练部分的代码train_ssl.py和intra-neg的生成部分gen_neg.py,输入的样本肯定是不一样的。

因为固定了随机数种子,所以对于相同实验环境,如果参数一致结果应该是一致的。
由于best model都是best_model_141.pt,所以我觉得很有可能两次实验的各项参数都相同。
因此对于自监督部分的训练部分,可能还需要你那边再确认一下。

更详细的调试可以去看两个模型的同一个iteration的输入,或者是你已经训练好的两次模型的best_model_141.pt的参数是否一致。

对于finetune的结果来讲,73.5算是比较正常的数值。

from iic.

Mrbishuai avatar Mrbishuai commented on September 28, 2024

感谢您百忙之中对我的回复,我对代码又进行了训练,发现了一个问题不是很明白。当直接运行python ft_classify.py --ckpt=/path/to/your/model --dataset=ucf101 --mode=test测试时必须修改ft.classify.py
if args.mode == 'train':
model.load_state_dict(pretrained_weights['model'], strict=False)
else:
#model.load_state_dict(pretrained_weights['model'], strict=True)
model.load_state_dict(pretrained_weights, strict=True)
改为:
if args.mode == 'train':
model.load_state_dict(pretrained_weights['model'], strict=False)
else:
#model.load_state_dict(pretrained_weights['model'], strict=True)
model.load_state_dict(pretrained_weights['model'], strict=True)
我想知道是不是会对结果产生影响呢?

from iic.

BestJuly avatar BestJuly commented on September 28, 2024

这部分主要看用的是什么模型,model.load_state_dict()只是用来load模型权重的变量。

strict=True主要是在测试时使用,一方面也检查模型是否参数正确,因为在finetine的时候最后的分类层是新的,如果在finetune时设置strict=True检查,那么只会显示fc层load有问题,这样的话fc层就是新的,可以放心设置成False进行finetune。

至于第一个参数,主要就是解析好的模型的参数。有些代码可能直接就是torch.load(checkpoint)。这部分的话当时是怎么存储就怎么load,比如是以dict形式,那么就要加上类似pretrained_weights['model']。如果是参数名有变化,则可以加一个函数过滤一下。

在我这边的代码里,如果两个都可以的话,应该是没有区别的。我看了一下我的finetune.py部分和前面train_ssl.py部分其实模型存储的时候都是以dict的形式。finetune部分因为dict只有一个key,所以应该这么写也正确load了,当时写的时候没怎么注意。

from iic.

Mrbishuai avatar Mrbishuai commented on September 28, 2024

谢谢您在百忙之中给我回复,最近我发现您的又一篇文章,再次基础上进行的大幅的提升,Self-Supervised Video Representation Using Pretext-Contrastive Learning不知道您是否愿意在方便的时候将代码发给我,以供学习。我的邮箱[email protected],谢谢您!

from iic.

BestJuly avatar BestJuly commented on September 28, 2024

@Mrbishuai 完整版本包含较多的组合,比较忙没怎么整理,一个可用的toy版本在我的这个repo里。

from iic.

Related Issues (13)

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.