本文整理汇总了Java中net.semanticmetadata.lire.impl.FastOpponentImageSearcher类的典型用法代码示例。如果您正苦于以下问题:Java FastOpponentImageSearcher类的具体用法?Java FastOpponentImageSearcher怎么用?Java FastOpponentImageSearcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FastOpponentImageSearcher类属于net.semanticmetadata.lire.impl包,在下文中一共展示了FastOpponentImageSearcher类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFastSearch
import net.semanticmetadata.lire.impl.FastOpponentImageSearcher; //导入依赖的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);
}