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; }
protected Set<Integer> selectInitialMedians(int numClusters) { return StatsUtils.drawSample(numClusters, features.size()); }
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(); } } }
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; }
protected Set<Integer> selectInitialMedians(int numClusters) { return StatsUtils.drawSample(numClusters, features.size()); }
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(); } } }
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));
protected Set<Integer> selectInitialMedians(int numClusters) { return StatsUtils.drawSample(numClusters, features.size()); }
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();
} 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());
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();
int queryLength = (int) StatsUtils.clamp(numberOfQueryTerms * MetricSpaces.getPostingListLength(queryFeature), 3, MetricSpaces.getPostingListLength(queryFeature)); queryString = MetricSpaces.generateBoostedQuery(queryFeature, queryLength);
} 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());