Package com.meapsoft.featextractors

Examples of com.meapsoft.featextractors.FeatureExtractor


   
    for (int i = 0; i < featureStrings.length; i++)
    {
      try
      {
        FeatureExtractor fE = (FeatureExtractor)(Class.forName("com.meapsoft.featextractors." + featureStrings[i]).newInstance());
        featureExtractors.add(fE);
      }
      catch (Exception e)
      {
        System.out.println("uh oh in getFeatures...");
View Full Code Here


      // compute features from the STFT
      ListIterator i = featExts.listIterator();
      while (i.hasNext())
      {
        FeatureExtractor fe = (FeatureExtractor) i.next();
        // we don't want to run meta feature extractors yet!
        if (!(fe instanceof MetaFeatureExtractor))
        {
          //System.out.println("\ndoing: " + fe.description().substring(0,30));
          long chunkStartFrame = stft.seconds2fr(ch.startTime);
          int nframes = (int) stft.seconds2fr(ch.length);
          long chunkEndFrame = chunkStartFrame + nframes;

          // make sure stft contains valid data for us.
          long lastFrame = stft.getLastFrameAddress();
         
          int numFramesToRead = 0;
          int framesRead = -1;
         
          if (chunkStartFrame > lastFrame)
          {
            numFramesToRead = (int) (chunkStartFrame - lastFrame + nframes + 1);
            framesRead = stft.readFrames(numFramesToRead);
            //System.out.println("chunkStartFrame > lastFrame");
          }
          else if (chunkEndFrame > lastFrame)
          {
            numFramesToRead = (int) (chunkEndFrame - lastFrame + 1);
            framesRead = stft.readFrames(numFramesToRead);
            //System.out.println("chunkEndFrame > lastFrame");
          }
         
          //System.out.println("chunkStartFrame: " + chunkStartFrame + " nframes: " + nframes +
          //    " chunkEndFrame: " + chunkEndFrame + " numFramesToRead: " + numFramesToRead +
          //    " framesRead: " + framesRead + " lastFrame: " + lastFrame);
          double[] feats = fe.features(stft, (int) chunkStartFrame,
              nframes, true);

          ch.addFeature(feats);

          // what features are we adding?
          if (!wroteFeatDesc)
          {
            String fullName = fe.getClass().getName();
            //System.out.println("fullName: " + fullName);
            String[] nameParts = fullName.split("\\.");
            String featString = nameParts[nameParts.length - 1] + "("
                + feats.length + ") ";
            //System.out.println("featString: " + featString);
            if (featExtWeights != null)
            {
              int idx = i.nextIndex() - 1;
              if (idx < featExtWeights.size())
                featString = featExtWeights.get(idx) + "*"
                    + featString;
            }
            file.featureDescriptions.add(featString);
          }
        }

        progress.setValue(progress.getValue() + 1);
      }

      wroteFeatDesc = true;
    }

    // now do meta feature extractors
    boolean descriptionsCleared = false;
    ListIterator i = featExts.listIterator();
    while (i.hasNext())
    {
      FeatureExtractor fe = (FeatureExtractor) i.next();
      if (fe instanceof MetaFeatureExtractor)
      {
        if (!descriptionsCleared)
        {
          if (clearNonMetaFeatures)
            file.featureDescriptions.clear();

          file.normalizeFeatures();
          file.applyFeatureWeights();

          descriptionsCleared = true;
        }

        // this obliterates any other features
        ((MetaFeatureExtractor) fe)
            .features(file, clearNonMetaFeatures);

        // what features are we adding?
        String featString = fe.getClass().getName() + "(" + 1 + ") ";
        if (featExtWeights != null)
        {
          int idx = i.nextIndex() - 1;
          if (idx < featExtWeights.size())
            featString = featExtWeights.get(idx) + "*" + featString;
View Full Code Here

    //JPanel mFEPanel = null;
    for (int i = 0; i < classNames.size(); i++)
    {
      String name = (String)classNames.elementAt(i);
     
      FeatureExtractor f = null;
      try
      {
        f = (FeatureExtractor)(Class.forName("com.meapsoft.featextractors." + name).newInstance());
      }
      catch (Exception e)
View Full Code Here

            if(v2 != null)
                v.addAll(v2);
           
            for (int i = 0; i < v.size(); i++)
            {
        FeatureExtractor f = null;
       
        try
        {
          String name = "com.meapsoft.featextractors." + (String)v.elementAt(i);
          f = (FeatureExtractor)(Class.forName(name).newInstance());
          featureDescriptions.add(f.description());
        }
        catch (Exception e)
        {
          GUIUtils.ShowDialog("", GUIUtils.MESSAGE, meapsoftGUI.jframe)
                    //ShowDialog(e, "", FATAL_ERROR);
View Full Code Here

            try
            {
                if (cb.isSelected())
                {
                  FeatureExtractor fe = (FeatureExtractor)(Class.forName("com.meapsoft.featextractors." + cb.getText())
          .newInstance());
          if (fe instanceof MetaFeatureExtractor)
            metaFE = true;
          else
            regularFE = true;
View Full Code Here

            // compute features from the STFT
            ListIterator i = featExts.listIterator();
            while(i.hasNext())
            {
        FeatureExtractor fe = (FeatureExtractor)i.next();
        //we don't want to run meta feature extractors yet!
        if (!(fe instanceof MetaFeatureExtractor))
        {         
                    long chunkStartFrame = stft.seconds2fr(ch.startTime);
                    int nframes = (int)stft.seconds2fr(ch.length);
                    long chunkEndFrame = chunkStartFrame + nframes;
                   
                    // make sure stft contains valid data for us.
                    long lastFrame = stft.getLastFrameAddress();
                    if(chunkStartFrame > lastFrame)
                        stft.readFrames(chunkStartFrame - lastFrame + nframes + 1);
                    else if(chunkEndFrame > lastFrame)
                        stft.readFrames(chunkEndFrame - lastFrame + 1);

                   
                    double[] feats = fe.features(stft, (int)chunkStartFrame, nframes);

                  ch.addFeature(feats);
 
                    // what features are we adding? 
                  if(!wroteFeatDesc)
                  {
            String featString = fe.getClass().getName() + "(" + feats.length + ") ";
                        if(featExtWeights != null)
                        {
                            int idx = i.nextIndex()-1;
                            if(idx < featExtWeights.size())
                                featString = featExtWeights.get(idx)+"*"+featString;
                        }
                      file.featureDescriptions.add(featString);
                  }
        }

                progress.setValue(progress.getValue()+1);
            }

            wroteFeatDesc = true;
        }
   
    //now do meta feature extractors
    boolean descriptionsCleared = false;
    ListIterator i = featExts.listIterator();
    while(i.hasNext())
    {
      FeatureExtractor fe = (FeatureExtractor)i.next();
      if (fe instanceof MetaFeatureExtractor)
      { 
        if (!descriptionsCleared)
        {
                    if(clearNonMetaFeatures)
                        file.featureDescriptions.clear();

                    // sk: remove normalization and feature weighting
                    //file.normalizeFeatures();
                    //file.applyFeatureWeights();

          descriptionsCleared = true;
        }

                // this obliterates any other features
                ((MetaFeatureExtractor)fe).features(file, clearNonMetaFeatures);
       
        // what features are we adding? 
        String featString = fe.getClass().getName() + "(" + 1 + ") ";
                if(featExtWeights != null)
                {
                    int idx = i.nextIndex()-1;
                    if(idx < featExtWeights.size())
                        featString = featExtWeights.get(idx)+"*"+featString;
 
View Full Code Here

TOP

Related Classes of com.meapsoft.featextractors.FeatureExtractor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.