Coder Social home page Coder Social logo

using gen_weight_File about psla HOT 1 OPEN

MichaelB0312 avatar MichaelB0312 commented on May 28, 2024
using gen_weight_File

from psla.

Comments (1)

YuanGongND avatar YuanGongND commented on May 28, 2024

Hi,

The weight file is used here:

psla/src/run.py

Lines 82 to 85 in 46a53b9

if args.bal == True:
print('balanced sampler is being used')
samples_weight = np.loadtxt(args.data_train[:-5] + '_weight.csv', delimiter=',')
sampler = WeightedRandomSampler(samples_weight, len(samples_weight), replacement=True)

Basically, in gen_weight_file, the weight of each sample is sum(1/class_frequency), note for audioset, each sample has multiple classes, that's why sum is needed. The idea is to give rare class higher weight.

Then in

sampler = WeightedRandomSampler(samples_weight, len(samples_weight), replacement=True)
, the weight is used to sampling in dataloading, i.e., a sound clip with rare class is more likely to be seen by the model. The algorithm can be found in the paper.

-Yuan

from psla.

Related Issues (12)

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.