本文整理汇总了Java中org.nd4j.linalg.dataset.api.preprocessor.ImagePreProcessingScaler类的典型用法代码示例。如果您正苦于以下问题:Java ImagePreProcessingScaler类的具体用法?Java ImagePreProcessingScaler怎么用?Java ImagePreProcessingScaler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImagePreProcessingScaler类属于org.nd4j.linalg.dataset.api.preprocessor包,在下文中一共展示了ImagePreProcessingScaler类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getDataSetIterator
import org.nd4j.linalg.dataset.api.preprocessor.ImagePreProcessingScaler; //导入依赖的package包/类
/**
* This method returns the iterator. Scales all intensity values: it divides them by 255.
*
* @param data the dataset to use
* @param seed the seed for the random number generator
* @param batchSize the batch size to use
* @return the iterator
* @throws Exception
*/
@Override
public DataSetIterator getDataSetIterator(Instances data, int seed, int batchSize)
throws Exception {
batchSize = Math.min(data.numInstances(), batchSize);
validate(data);
ImageRecordReader reader = getImageRecordReader(data);
final int labelIndex = 1; // Use explicit label index position
final int numPossibleLabels = data.numClasses();
DataSetIterator tmpIter =
new RecordReaderDataSetIterator(reader, batchSize, labelIndex, numPossibleLabels);
DataNormalization scaler = new ImagePreProcessingScaler(0, 1);
scaler.fit(tmpIter);
tmpIter.setPreProcessor(scaler);
return tmpIter;
}
开发者ID:Waikato,项目名称:wekaDeeplearning4j,代码行数:27,代码来源:ImageInstanceIterator.java
示例2: predictImage
import org.nd4j.linalg.dataset.api.preprocessor.ImagePreProcessingScaler; //导入依赖的package包/类
private void predictImage(BufferedImage img ) throws IOException {
ImagePreProcessingScaler imagePreProcessingScaler = new ImagePreProcessingScaler(0, 1);
INDArray image = loader.asRowVector(img);
imagePreProcessingScaler.transform(image);
INDArray output = model.output(image);
String putStr = output.toString();
lblResult.setText("Prediction: " + model.predict(image)[0] + "\n " + putStr);
}
开发者ID:jesuino,项目名称:java-ml-projects,代码行数:9,代码来源:MnistTestFXApp.java
示例3: createInternal
import org.nd4j.linalg.dataset.api.preprocessor.ImagePreProcessingScaler; //导入依赖的package包/类
private DataSetIterator createInternal(InputSplit inputSplit) throws IOException {
ImageTransform imageTransform = imageTransformFactory.create();
int width = imageTransformConfigurationResource.getScaledWidth();
int height = imageTransformConfigurationResource.getScaledHeight();
int channels = imageTransformConfigurationResource.getChannels();
int batchSize = networkConfigurationResource.getBatchSize();
int outputs = networkConfigurationResource.getOutputs();
ImageRecordReader recordReader = new ImageRecordReader(height, width, channels, pathLabelGenerator);
recordReader.initialize(inputSplit, imageTransform);
RecordReaderDataSetIterator recordReaderDataSetIterator = new RecordReaderDataSetIterator(recordReader, batchSize, 1, outputs);
DataNormalization scaler = new ImagePreProcessingScaler(0, 1);
scaler.fit(recordReaderDataSetIterator);
recordReaderDataSetIterator.setPreProcessor(scaler);
return recordReaderDataSetIterator;
}
开发者ID:scaliby,项目名称:ceidg-captcha,代码行数:16,代码来源:DataSetIteratorFactoryImpl.java
示例4: evaluateModel
import org.nd4j.linalg.dataset.api.preprocessor.ImagePreProcessingScaler; //导入依赖的package包/类
public void evaluateModel(File file) throws IOException {
log.info("Evaluate model....");
NativeImageLoader nativeImageLoader = new NativeImageLoader(height, width, channels);
INDArray image = nativeImageLoader.asMatrix(file); // testImage is of Mat format
// 0-255 to 0-1
DataNormalization scaler = new ImagePreProcessingScaler(0, 1);
scaler.transform(image);
// Pass through to neural Net
INDArray output = network.output(image);
System.out.println(output);
System.out.println(networkLabels);
// TODO: I suppose we could create a map of probabilities and return that ...
// this map could be large
}
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:15,代码来源:Deeplearning4j.java
注:本文中的org.nd4j.linalg.dataset.api.preprocessor.ImagePreProcessingScaler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论