public abstract class BaseImageRecordReader extends BaseRecordReader
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
appendLabel |
protected long |
channels |
static String |
CHANNELS |
protected Configuration |
conf |
static String |
CROP_IMAGE |
protected boolean |
cropImage |
protected File |
currentFile |
protected Map<String,String> |
fileNameMap |
protected boolean |
finishedInputStreamSplit |
protected long |
height |
static String |
HEIGHT |
protected boolean |
hitImage |
static String |
IMAGE_LOADER |
protected BaseImageLoader |
imageLoader |
protected ImageTransform |
imageTransform |
protected InputSplit |
inputSplit |
protected Iterator<File> |
iter |
protected PathLabelGenerator |
labelGenerator |
protected PathMultiLabelGenerator |
labelMultiGenerator |
protected List<String> |
labels |
protected boolean |
logLabelCountOnInit |
protected boolean |
nchw_channels_first |
protected String |
pattern |
protected int |
patternPosition |
protected List<Writable> |
record |
protected long |
width |
static String |
WIDTH |
protected boolean |
writeLabel |
listeners, streamCreatorFnAPPEND_LABEL, LABELS, NAME_SPACE| Modifier | Constructor and Description |
|---|---|
|
BaseImageRecordReader() |
protected |
BaseImageRecordReader(long height,
long width,
long channels,
boolean nchw_channels_first,
PathLabelGenerator labelGenerator,
PathMultiLabelGenerator labelMultiGenerator,
ImageTransform imageTransform) |
|
BaseImageRecordReader(long height,
long width,
long channels,
PathLabelGenerator labelGenerator) |
|
BaseImageRecordReader(long height,
long width,
long channels,
PathLabelGenerator labelGenerator,
ImageTransform imageTransform) |
protected |
BaseImageRecordReader(long height,
long width,
long channels,
PathLabelGenerator labelGenerator,
PathMultiLabelGenerator labelMultiGenerator,
ImageTransform imageTransform) |
|
BaseImageRecordReader(long height,
long width,
long channels,
PathMultiLabelGenerator labelGenerator) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
accumulateLabel(String path)
Accumulate the label from the path
|
boolean |
batchesSupported() |
void |
close() |
protected boolean |
containsFormat(String format) |
Configuration |
getConf() |
File |
getCurrentFile()
Returns the file loaded last by
next(). |
String |
getLabel(String path)
Get the label from the given path
|
List<String> |
getLabels() |
boolean |
hasNext() |
void |
initialize(Configuration conf,
InputSplit split) |
void |
initialize(Configuration conf,
InputSplit split,
ImageTransform imageTransform)
Called once at initialization.
|
void |
initialize(InputSplit split) |
void |
initialize(InputSplit split,
ImageTransform imageTransform)
Called once at initialization.
|
List<Record> |
loadFromMetaData(List<RecordMetaData> recordMetaDatas) |
Record |
loadFromMetaData(RecordMetaData recordMetaData) |
List<Writable> |
next() |
List<List<Writable>> |
next(int num) |
Record |
nextRecord() |
int |
numLabels()
Returns
getLabels().size(). |
List<Writable> |
record(URI uri,
DataInputStream dataInputStream) |
void |
reset() |
boolean |
resetSupported() |
void |
setConf(Configuration conf) |
void |
setCurrentFile(File currentFile)
Sets manually the file returned by
getCurrentFile(). |
void |
setLabels(List<String> labels) |
getListeners, invokeListeners, setListeners, setListenersprotected boolean finishedInputStreamSplit
protected Configuration conf
protected File currentFile
protected PathLabelGenerator labelGenerator
protected PathMultiLabelGenerator labelMultiGenerator
protected boolean appendLabel
protected boolean writeLabel
protected boolean hitImage
protected long height
protected long width
protected long channels
protected boolean cropImage
protected ImageTransform imageTransform
protected BaseImageLoader imageLoader
protected InputSplit inputSplit
protected String pattern
protected int patternPosition
protected boolean logLabelCountOnInit
protected boolean nchw_channels_first
public static final String HEIGHT
public static final String WIDTH
public static final String CHANNELS
public static final String CROP_IMAGE
public static final String IMAGE_LOADER
public BaseImageRecordReader()
public BaseImageRecordReader(long height,
long width,
long channels,
PathLabelGenerator labelGenerator)
public BaseImageRecordReader(long height,
long width,
long channels,
PathMultiLabelGenerator labelGenerator)
public BaseImageRecordReader(long height,
long width,
long channels,
PathLabelGenerator labelGenerator,
ImageTransform imageTransform)
protected BaseImageRecordReader(long height,
long width,
long channels,
PathLabelGenerator labelGenerator,
PathMultiLabelGenerator labelMultiGenerator,
ImageTransform imageTransform)
protected BaseImageRecordReader(long height,
long width,
long channels,
boolean nchw_channels_first,
PathLabelGenerator labelGenerator,
PathMultiLabelGenerator labelMultiGenerator,
ImageTransform imageTransform)
protected boolean containsFormat(String format)
public void initialize(InputSplit split) throws IOException
initialize in interface RecordReaderinitialize in class BaseRecordReaderIOExceptionpublic void initialize(Configuration conf, InputSplit split) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void initialize(InputSplit split, ImageTransform imageTransform) throws IOException
split - the split that defines the range of records to readimageTransform - the image transform to use to transform images while loading themIOExceptionpublic void initialize(Configuration conf, InputSplit split, ImageTransform imageTransform) throws IOException, InterruptedException
conf - a configuration for initializationsplit - the split that defines the range of records to readimageTransform - the image transform to use to transform images while loading themIOExceptionInterruptedExceptionpublic boolean hasNext()
public boolean batchesSupported()
batchesSupported in interface RecordReaderbatchesSupported in class BaseRecordReaderpublic List<List<Writable>> next(int num)
next in interface RecordReadernext in class BaseRecordReaderpublic void close()
throws IOException
IOExceptionpublic void setConf(Configuration conf)
public Configuration getConf()
public String getLabel(String path)
path - the path to get the label fromprotected void accumulateLabel(String path)
path - the path to get the label frompublic void setCurrentFile(File currentFile)
getCurrentFile().public void reset()
public boolean resetSupported()
public int numLabels()
getLabels().size().public List<Writable> record(URI uri, DataInputStream dataInputStream) throws IOException
IOExceptionpublic Record nextRecord()
public Record loadFromMetaData(RecordMetaData recordMetaData) throws IOException
IOExceptionpublic List<Record> loadFromMetaData(List<RecordMetaData> recordMetaDatas) throws IOException
IOExceptionCopyright © 2022. All rights reserved.