sw.stop(); 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) {
sw.stop(); 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) {
public void testSearchDocValues() throws IOException { IndexReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexNameDV))); GenericDocValuesImageSearcher is = new GenericDocValuesImageSearcher(10, CEDD.class, reader); // run search StopWatch sm = new StopWatch(); BufferedImage qImage = ImageIO.read(new FileInputStream(queryImage)); ImageSearchHits hits = null; for (int i = 0; i<numRuns; i++) { sm.start(); hits = is.search(qImage, reader); sm.stop(); } // print results for (int i = 0; i < hits.length(); i++) { String fileName = reader.document(hits.documentID(i)).getValues(GlobalDocumentBuilder.FIELD_NAME_IDENTIFIER)[0]; System.out.println(hits.score(i) + ": \t" + fileName); } System.out.printf("\nTime for searching: %02.3f ms\n", sm.getTime() / (double) numRuns); }
public void testSearchCaching() throws IOException { IndexReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexName))); GenericFastImageSearcher is = new GenericFastImageSearcher(10, CEDD.class, true, reader); // run search StopWatch sm = new StopWatch(); BufferedImage qImage = ImageIO.read(new FileInputStream(queryImage)); ImageSearchHits hits = null; for (int i = 0; i<numRuns; i++) { sm.start(); hits = is.search(qImage, reader); sm.stop(); } // print results for (int i = 0; i < hits.length(); i++) { String fileName = reader.document(hits.documentID(i)).getValues(GlobalDocumentBuilder.FIELD_NAME_IDENTIFIER)[0]; System.out.println(hits.score(i) + ": \t" + fileName); } System.out.printf("\nTime for searching: %02.3f ms\n", sm.getTime() / (double) numRuns); }
public void testSearchPlain() throws IOException { IndexReader reader = DirectoryReader.open(FSDirectory.open(Paths.get(indexName))); GenericFastImageSearcher is = new GenericFastImageSearcher(10, CEDD.class, false, reader); // run search StopWatch sm = new StopWatch(); BufferedImage qImage = ImageIO.read(new FileInputStream(queryImage)); ImageSearchHits hits = null; for (int i = 0; i< numRuns; i++) { sm.start(); hits = is.search(qImage, reader); sm.stop(); } // print results for (int i = 0; i < hits.length(); i++) { String fileName = reader.document(hits.documentID(i)).getValues(GlobalDocumentBuilder.FIELD_NAME_IDENTIFIER)[0]; System.out.println(hits.score(i) + ": \t" + fileName); } System.out.printf("\nTime for searching: %02.3f ms\n", sm.getTime() / (double) numRuns); } }
sw0.start(); GenericFastImageSearcher gis = new GenericFastImageSearcher(100, CEDD.class, true, reader); sw0.stop(); System.out.printf("Startup latency of cached searcher: %02.3f sec\n", sw0.getTime()/1000d); GenericFastImageSearcher lis = new GenericFastImageSearcher(100, CEDD.class, false, reader); sw1.start(); ImageSearchHits hits = gis.search(reader.document(i), reader); sw1.stop(); sw2.stop(); sw3.stop(); sw4.stop();