當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageSearcherFactory類代碼示例

本文整理匯總了Java中net.semanticmetadata.lire.ImageSearcherFactory的典型用法代碼示例。如果您正苦於以下問題:Java ImageSearcherFactory類的具體用法?Java ImageSearcherFactory怎麽用?Java ImageSearcherFactory使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ImageSearcherFactory類屬於net.semanticmetadata.lire包,在下文中一共展示了ImageSearcherFactory類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testPerformance

import net.semanticmetadata.lire.ImageSearcherFactory; //導入依賴的package包/類
public void testPerformance() throws IOException {
    MetricSpacesInvertedListIndexing mes = MetricSpacesInvertedListIndexing.getDefaultInstance();
    int numSearches = 10;
    IndexReader reader = mes.getIndexReader(indexPath);
    System.out.println(reader.maxDoc() + " documents");
    TopDocs docs;

    long ms = System.currentTimeMillis();
    for (int i = 0; i < numSearches; i++) {
        docs = mes.search(reader.document(i), indexPath);
    }
    ms = System.currentTimeMillis() - ms;
    System.out.println("ms = " + ms);


    ImageSearcher ceddSearcher = ImageSearcherFactory.createCEDDImageSearcher(100);
    ms = System.currentTimeMillis();
    for (int i = 0; i < numSearches; i++) {
        ceddSearcher.search(reader.document(i), reader);
    }
    ms = System.currentTimeMillis() - ms;
    System.out.println("ms = " + ms);
}
 
開發者ID:fish2000,項目名稱:lire,代碼行數:24,代碼來源:MetricSpacesTest.java

示例2: testFastSearch

import net.semanticmetadata.lire.ImageSearcherFactory; //導入依賴的package包/類
public void testFastSearch() throws IOException {
        Codec.forName("LireCustomCodec");
//        ParallelIndexer pin = new ParallelIndexer(7, "./index-fast-3", "testdata/wang-1000") {
        ParallelIndexer pin = new ParallelIndexer(7, "./index-fast-3", "D:\\DataSets\\Flickrphotos\\01", true) {
            @Override
            public void addBuilders(ChainedDocumentBuilder builder) {
                builder.addBuilder(DocumentBuilderFactory.getOpponentHistogramDocumentBuilder());
            }
        };
        pin.run();
        IndexReader ir = DirectoryReader.open(MMapDirectory.open(new File("./index-fast-3")));
        System.out.println("ir.maxDoc() = " + ir.maxDoc());

        long ms = System.currentTimeMillis();
        ImageSearcher is = new FastOpponentImageSearcher(50);
        ms = System.currentTimeMillis() - ms;
        System.out.println("init ms = " + ms);

        ms = System.currentTimeMillis();
        for (int i = 0; i < 100; i++) is.search(ir.document(i), ir);
        ms = System.currentTimeMillis() - ms;
        System.out.println("cached ms = " + ms);

        is = ImageSearcherFactory.createOpponentHistogramSearcher(50);
        ms = System.currentTimeMillis();
        for (int i = 0; i < 100; i++) is.search(ir.document(i), ir);
        ms = System.currentTimeMillis() - ms;
        System.out.println("read from Lucene ms = " + ms);
    }
 
開發者ID:fish2000,項目名稱:lire,代碼行數:30,代碼來源:OpponentHistogramTest.java

示例3: main

import net.semanticmetadata.lire.ImageSearcherFactory; //導入依賴的package包/類
public static void main(String[] args) throws IOException {
    // Checking if arg[0] is there and if it is an image.
    BufferedImage img = null;
    boolean passed = false;
    if (args.length > 0) {
        File f = new File(args[0]);
        if (f.exists()) {
            try {
                img = ImageIO.read(f);
                passed = true;
            } catch (IOException e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
        }
    }
    if (!passed) {
        System.out.println("No image given as first argument.");
        System.out.println("Run \"Searcher <query image>\" to search for <query image>.");
        System.exit(1);
    }

    IndexReader ir = DirectoryReader.open(FSDirectory.open(new File("index")));
    ImageSearcher searcher = ImageSearcherFactory.createCEDDImageSearcher(10);

    ImageSearchHits hits = searcher.search(img, ir);
    for (int i = 0; i < hits.length(); i++) {
        String fileName = hits.doc(i).getValues(DocumentBuilder.FIELD_NAME_IDENTIFIER)[0];
        System.out.println(hits.score(i) + ": \t" + fileName);
    }
}
 
開發者ID:fish2000,項目名稱:lire,代碼行數:31,代碼來源:Searcher.java

示例4: testMAP

import net.semanticmetadata.lire.ImageSearcherFactory; //導入依賴的package包/類
public void testMAP() {
        computeMAP(ImageSearcherFactory.createColorHistogramImageSearcher(4952), "Color Histogram - JSD");
//        computeMAP(new SiftVisualWordsImageSearcher(4952), "Sift BoVW");

    }
 
開發者ID:fish2000,項目名稱:lire,代碼行數:6,代碼來源:TestPascalVOC2007.java


注:本文中的net.semanticmetadata.lire.ImageSearcherFactory類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。