Tabnine Logo
StatsUtils
Code IndexAdd Tabnine to your IDE (free)

How to use
StatsUtils
in
net.semanticmetadata.lire.utils

Best Java code snippets using net.semanticmetadata.lire.utils.StatsUtils (Showing top 13 results out of 315)

origin: dermotte/LIRE

private LinkedList<keypoint> createGaussRndPts(int width, int height, int samples) {
  Random ran = new Random();
  int size, x, y;
  keypoint key;
  LinkedList<keypoint> keypointsList = new LinkedList<keypoint>();
  sizeLookUp = getLookupTable(Math.min(width, height)/4);
  for (int i = 0; i < samples; i++) {
    size = sizeLookUp[ran.nextInt(sizeLookUp.length)];
    // sanity check: Is the size fit for the image size?!?
    if (size > Math.min(width, height)) {
      System.err.println("[" + getClass().getName() + "] Too big a patch for this image. Consider using bigger images.");
      size = sizeLookUp[0];
    }
    // bounding box
    double boundx = width - size;
    double boundy = height - size;
    // System.out.printf("(%d, %d) %d, %f -- ", width, height, size, boundx);
    x = (int) Math.floor(StatsUtils.clamp(ran.nextGaussian(), -3, 3) / 3d * boundx / 2 + width / 2);
    y = (int) Math.floor(StatsUtils.clamp(ran.nextGaussian(), -3, 3) / 3d * boundy / 2 + height / 2);
    // System.out.printf("(%d, %d)\n", x, y);
    key = new keypoint(x, y, size);
    keypointsList.add(key);
  }
  return keypointsList;
}
origin: dermotte/LIRE

protected Set<Integer> selectInitialMedians(int numClusters) {
  return StatsUtils.drawSample(numClusters, features.size());
}
origin: dermotte/LIRE

public void run() {
  long end, gap = 1000 * monitoringInterval;
  long start = System.currentTimeMillis();
  try {
    Thread.sleep(gap); // wait xx seconds
  } catch (InterruptedException e) {
    e.printStackTrace();
  }
  while (isRunning) {
    try {
      // print the current status:
      end = System.currentTimeMillis() - start;
      System.out.printf("Analyzed %d images in %s ~ %3.2f ms each. (queue size is %d)\n", overallCount, StatsUtils.convertTime(end), ((overallCount > 0) ? ((float) end / (float) overallCount) : -1f), queue.size());
      Thread.sleep(gap); // wait xx seconds
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
}
origin: dermotte/LIRE

private LinkedList<keypoint> createGaussRndPts(int width, int height, int samples) {
  Random ran = new Random();
  int size, x, y;
  keypoint key;
  LinkedList<keypoint> keypointsList = new LinkedList<keypoint>();
  sizeLookUp = getLookupTable(Math.min(width, height)/4);
  for (int i = 0; i < samples; i++) {
    size = sizeLookUp[ran.nextInt(sizeLookUp.length)];
    // sanity check: Is the size fit for the image size?!?
    if (size > Math.min(width, height)) {
      System.err.println("[" + getClass().getName() + "] Too big a patch for this image. Consider using bigger images.");
      size = sizeLookUp[0];
    }
    // bounding box
    double boundx = width - size;
    double boundy = height - size;
    // System.out.printf("(%d, %d) %d, %f -- ", width, height, size, boundx);
    x = (int) Math.floor(StatsUtils.clamp(ran.nextGaussian(), -3, 3) / 3d * boundx / 2 + width / 2);
    y = (int) Math.floor(StatsUtils.clamp(ran.nextGaussian(), -3, 3) / 3d * boundy / 2 + height / 2);
    // System.out.printf("(%d, %d)\n", x, y);
    key = new keypoint(x, y, size);
    keypointsList.add(key);
  }
  return keypointsList;
}
origin: dermotte/LIRE

protected Set<Integer> selectInitialMedians(int numClusters) {
  return StatsUtils.drawSample(numClusters, features.size());
}
origin: dermotte/LIRE

public void run() {
  long end, gap = 1000 * monitoringInterval;
  long start = System.currentTimeMillis();
  try {
    Thread.sleep(gap); // wait xx seconds
  } catch (InterruptedException e) {
    e.printStackTrace();
  }
  while (isRunning) {
    try {
      // print the current status:
      end = System.currentTimeMillis() - start;
      System.out.printf("Analyzed %d images in %s ~ %3.2f ms each. (queue size is %d)\n", overallCount, StatsUtils.convertTime(end), ((overallCount > 0) ? ((float) end / (float) overallCount) : -1f), queue.size());
      Thread.sleep(gap); // wait xx seconds
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
}
origin: dermotte/liresolr

rsp.add("bs_list", hashStrings);
List<String> hashQuery = orderHashes(hashes, paramField, true);
int queryLength = (int) StatsUtils.clamp(accuracy * hashes.length,
    3, hashQuery.size());
rsp.add("bs_query", String.join(" ", hashQuery.subList(0, queryLength)));
int queryLength = (int) StatsUtils.clamp(accuracy * MetricSpaces.getPostingListLength(feat),
    3, MetricSpaces.getPostingListLength(feat));
rsp.add("ms_query", MetricSpaces.generateBoostedQuery(feat, queryLength));
origin: com.github.kzwang/lire

protected Set<Integer> selectInitialMedians(int numClusters) {
  return StatsUtils.drawSample(numClusters, features.size());
}
origin: dermotte/LIRE

    count++;
    if (count%1000==0) {
      System.out.printf("Processed %d images took %s minutes, ~%.2f ms per image.\n", (int) count, StatsUtils.convertTime(sw.getTimeSinceStart()), (double) sw.getTimeSinceStart()/count);
  System.out.printf("\nIt's finished. Processing %d images took %s minutes, ~%.2f ms per image.\n", (int) count, StatsUtils.convertTime(sw.getTime()), (double) sw.getTime()/count);
} catch (FileNotFoundException e) {
  e.printStackTrace();
origin: dermotte/liresolr

} else if (MetricSpaces.supportsFeature(feat)) {
  int queryLength = (int) StatsUtils.clamp(numberOfQueryTerms * MetricSpaces.getPostingListLength(feat), 3, MetricSpaces.getPostingListLength(feat));
  String msQuery = MetricSpaces.generateBoostedQuery(feat, queryLength);
  QueryParser qp = new QueryParser(paramField.replace("_ha", "_ms"), new WhitespaceAnalyzer());
origin: dermotte/LIRE

    count++;
    if (count%1000==0) {
      System.out.printf("Processed %d images took %s minutes, ~%.2f ms per image.\n", (int) count, StatsUtils.convertTime(sw.getTimeSinceStart()), (double) sw.getTimeSinceStart()/count);
  System.out.printf("\nIt's finished. Processing %d images took %s minutes, ~%.2f ms per image.\n", (int) count, StatsUtils.convertTime(sw.getTime()), (double) sw.getTime()/count);
} catch (FileNotFoundException e) {
  e.printStackTrace();
origin: dermotte/liresolr

int queryLength = (int) StatsUtils.clamp(numberOfQueryTerms * MetricSpaces.getPostingListLength(queryFeature),
    3, MetricSpaces.getPostingListLength(queryFeature));
queryString = MetricSpaces.generateBoostedQuery(queryFeature, queryLength);
origin: dermotte/liresolr

} else if (MetricSpaces.supportsFeature(queryFeature)) {
  int queryLength = (int) StatsUtils.clamp(numberOfQueryTerms * MetricSpaces.getPostingListLength(queryFeature), 3, MetricSpaces.getPostingListLength(queryFeature));
  String msQuery = MetricSpaces.generateBoostedQuery(queryFeature, queryLength);
  QueryParser qp = new QueryParser(paramField.replace("_ha", "_ms"), new WhitespaceAnalyzer());
net.semanticmetadata.lire.utilsStatsUtils

Javadoc

...

Most used methods

  • clamp
    Simple clamp function for floats.
  • drawSample
    Draws a set if size size of sample number from 0 to maximum, following an even distribution. Each dr
  • convertTime

Popular in Java

  • Running tasks concurrently on multiple threads
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • scheduleAtFixedRate (Timer)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now