Code Monkey home page Code Monkey logo

Comments (5)

zihangJiang avatar zihangJiang commented on May 18, 2024 1

Hi @lxy5513 ,

We've updated and tested support for transfer learning. The dataset folder structure should be the same as ImageNet structure https://github.com/zihangJiang/TokenLabeling#requirements (with train and val split). You can clone the main branch, try to specify --num-classes flag, and add --token-label --dense-weight 0 for fine-tuning.

Let me know if you have any further questions.

from tokenlabeling.

zihangJiang avatar zihangJiang commented on May 18, 2024

Hi,
Can you post your training script? The label smoothing is handled in Mixup & Cutmix here

TokenLabeling/main.py

Lines 484 to 488 in 9f71792

if mixup_active:
mixup_args = dict(
mixup_alpha=args.mixup, cutmix_alpha=args.cutmix, cutmix_minmax=args.cutmix_minmax,
prob=args.mixup_prob, switch_prob=args.mixup_switch_prob, mode=args.mixup_mode,
label_smoothing=args.smoothing, num_classes=args.num_classes)

and here

TokenLabeling/main.py

Lines 678 to 690 in 9f71792

if args.token_label and args.token_label_data:
target=create_token_label_target(target,num_classes=args.num_classes,
smoothing=args.smoothing, label_size=args.token_label_size)
if len(target.shape)==1:
target=create_token_label_target(target,num_classes=args.num_classes,
smoothing=args.smoothing)
else:
if args.token_label and args.token_label_data and not loader.mixup_enabled:
target=create_token_label_target(target,num_classes=args.num_classes,
smoothing=args.smoothing, label_size=args.token_label_size)
if len(target.shape)==1:
target=create_token_label_target(target,num_classes=args.num_classes,
smoothing=args.smoothing)

If you train without token labeling, We suggest you add --mixup 0.8 or --cutmix 1.0 as regularization, and use lvvit model. Model like lvvit_s returns all tokens by default which will cause error if you train without token labeling.
If you train with token labeling, please add --token-label flag.

from tokenlabeling.

lxy5513 avatar lxy5513 commented on May 18, 2024

@zihangJiang Thanks for your response.
My training script is here:
python main.py /home/liuxingyu/data/patrol/comfort_classification/nursery_v16 --model lvvit_m -b 64 --apex-amp --img-size 384 --drop-path 0.2 --token-label-size 24 --model-ema --finetune lvvit_m-56M-384-85.4.pth.tar --token-label-data ''

I train without token labeling, because I have not generate token labels for my custome dataset.

Model like lvvit_s returns all tokens by default which will cause error if you train without token labeling

Is this mean if I want to train without token labeling, I can't use pretrain model ?

from tokenlabeling.

zihangJiang avatar zihangJiang commented on May 18, 2024

We haven't tested on other datasets yet, but you can of course use the pre-trained model. I think you can add --token-label --dense-weight 0 flag. This can work without token label data.

However, some other bugs may occur. You can wait for our further update supporting transfer learning.

from tokenlabeling.

lxy5513 avatar lxy5513 commented on May 18, 2024

Well, thanks, expect for further update.

from tokenlabeling.

Related Issues (20)

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.