public class ObjectDetectionRecordReader extends BaseImageRecordReader
Format of returned values: 4d array, with dimensions [minibatch, 4+C, h, w] Where the image is quantized into h x w grid locations.
Note that this matches the format required for Deeplearning4j's Yolo2OutputLayer
Modifier and Type | Field and Description |
---|---|
protected Image |
currentImage |
appendLabel, channels, CHANNELS, conf, CROP_IMAGE, cropImage, currentFile, fileNameMap, finishedInputStreamSplit, height, HEIGHT, hitImage, IMAGE_LOADER, imageLoader, imageTransform, inputSplit, iter, labelGenerator, labelMultiGenerator, labels, logLabelCountOnInit, nchw_channels_first, pattern, patternPosition, record, width, WIDTH, writeLabel
listeners, streamCreatorFn
APPEND_LABEL, LABELS, NAME_SPACE
Constructor and Description |
---|
ObjectDetectionRecordReader(int height,
int width,
int channels,
int gridH,
int gridW,
ImageObjectLabelProvider labelProvider) |
ObjectDetectionRecordReader(int height,
int width,
int channels,
int gridH,
int gridW,
ImageObjectLabelProvider labelProvider,
ImageTransform imageTransform)
When imageTransform !
|
Modifier and Type | Method and Description |
---|---|
void |
initialize(InputSplit split)
Called once at initialization.
|
List<Writable> |
next()
Get the next record
|
List<List<Writable>> |
next(int num)
This method will be used, if batchesSupported() returns true.
|
Record |
nextRecord()
Similar to
RecordReader.next() , but returns a Record object, that may include metadata such as the source
of the data |
List<Writable> |
record(URI uri,
DataInputStream dataInputStream)
Load the record from the given DataInputStream
Unlike
RecordReader.next() the internal state of the RecordReader is not modified
Implementations of this method should not close the DataInputStream |
accumulateLabel, batchesSupported, close, containsFormat, getConf, getCurrentFile, getLabel, getLabels, hasNext, initialize, initialize, initialize, loadFromMetaData, loadFromMetaData, numLabels, reset, resetSupported, setConf, setCurrentFile, setLabels
getListeners, invokeListeners, setListeners, setListeners
protected Image currentImage
public ObjectDetectionRecordReader(int height, int width, int channels, int gridH, int gridW, ImageObjectLabelProvider labelProvider)
height
- Height of the output imageswidth
- Width of the output imageschannels
- Number of channels for the output imagesgridH
- Grid/quantization size (along height dimension) - Y axisgridW
- Grid/quantization size (along height dimension) - X axislabelProvider
- ImageObjectLabelProvider - used to look up which objects are in each imagepublic ObjectDetectionRecordReader(int height, int width, int channels, int gridH, int gridW, ImageObjectLabelProvider labelProvider, ImageTransform imageTransform)
height
- Height of the output imageswidth
- Width of the output imageschannels
- Number of channels for the output imagesgridH
- Grid/quantization size (along height dimension) - Y axisgridW
- Grid/quantization size (along height dimension) - X axislabelProvider
- ImageObjectLabelProvider - used to look up which objects are in each imageimageTransform
- ImageTransform - used to transform image and coordinatespublic List<Writable> next()
RecordReader
next
in interface RecordReader
next
in class BaseImageRecordReader
public void initialize(InputSplit split) throws IOException
RecordReader
initialize
in interface RecordReader
initialize
in class BaseImageRecordReader
split
- the split that defines the range of records to readIOException
public List<List<Writable>> next(int num)
RecordReader
next
in interface RecordReader
next
in class BaseImageRecordReader
public List<Writable> record(URI uri, DataInputStream dataInputStream) throws IOException
RecordReader
RecordReader.next()
the internal state of the RecordReader is not modified
Implementations of this method should not close the DataInputStreamrecord
in interface RecordReader
record
in class BaseImageRecordReader
IOException
- if error occurs during reading from the input streampublic Record nextRecord()
RecordReader
RecordReader.next()
, but returns a Record
object, that may include metadata such as the source
of the datanextRecord
in interface RecordReader
nextRecord
in class BaseImageRecordReader
Copyright © 2020. All rights reserved.