public class ImageSet extends TabularDataSet<ExampleImage>
TabularDataSet.Item
Constructor and Description |
---|
ImageSet(int imageWidth,
int imageHeight)
Creates empty image set for images of specified size.
|
ImageSet(int imageWidth,
int imageHeight,
String imageDirPath)
Creates image set with images from specified directory path.
|
Modifier and Type | Method and Description |
---|---|
javax.visrec.ml.data.DataSet<ExampleImage> |
add(ExampleImage exImage)
Adds an example image that will be used to train deep learning model to this set.
|
Map<String,Integer> |
countByClasses() |
boolean |
getBrightness() |
boolean |
getCropCornersAndCenter() |
String |
getDelimiter() |
boolean |
getFlipHorizontal() |
boolean |
getGrayscale() |
boolean |
getInvertImages() |
int |
getLabelsCount() |
Tensor |
getMean() |
ImageResize |
getResizeStrategy() |
boolean |
getScaleImages()
Returns flag that indicates wheather images should be scaled to specified
dimensions while creating image set.
|
String[] |
getTargetColumnsNames()
Returns output/image labels.
|
boolean |
getTranslate() |
boolean |
getZeroMeanPixels() |
void |
loadImages(File imageIdxFile)
Loads example images with corresponding labels from the specified file.
|
void |
loadImages(File imageIdxFile,
int numOfImages)
Loads specified number of example images with corresponding labels from
the specified file.
|
void |
loadImages(String imageIdxFile)
Loads images from the specified image index file.
|
String[] |
loadLabels(File file)
Loads and returns image labels to train neural network from the specified
file.These labels will be used to label network's outputs.
|
String[] |
loadLabels(String filePath)
Loads and returns image labels to train neural network from the specified
file.
|
void |
setBrightness(boolean brightness) |
void |
setCropCornersAndCenter(boolean cropCornersAndCenter) |
void |
setDelimiter(String delimiter) |
void |
setFlipHorizontal(boolean flipHorizontal) |
void |
setGrayscale(boolean grayscale) |
void |
setInvertImages(boolean invertImages) |
void |
setResizeStrategy(ImageResize resizeStrategy) |
void |
setScaleImages(boolean scaleImages) |
void |
setTranslate(boolean translate) |
ImageSet[] |
split(double... partSizes)
Splits data set into several parts specified by the input parameter
partSizes.
|
Tensor |
zeroMean()
Applies zero mean normalization to entire dataset, and returns mean
tensor.
|
countMissingValues, countMissingValues, getColumnNames, getNumInputs, getNumOutputs, hasMissingValues, hasMissingValues, setColumnNames, shuffle, shuffle, split
getColumns, getItems, setAsTargetColumns, setAsTargetColumns, setColumns
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addAll, clear, get, isEmpty, iterator, shuffle, size, split, split, split, stream
forEach, spliterator
public ImageSet(int imageWidth, int imageHeight)
imageWidth
- imageHeight
- public ImageSet(int imageWidth, int imageHeight, String imageDirPath) throws IOException
imageWidth
- all images in set will be scaled to this widthimageHeight
- all images in set will be scaled to this heightimageDirPath
- path to the root directory which contains subdirectories with imagesIOException
public javax.visrec.ml.data.DataSet<ExampleImage> add(ExampleImage exImage) throws DeepNettsException
exImage
- holds raw image pixel data and corresponding image labelDeepNettsException
- if image is empty or has wrong dimensions.public void loadImages(String imageIdxFile) throws FileNotFoundException
imageIdxFile
- txt file with list of imagesFileNotFoundException
public void loadImages(File imageIdxFile) throws FileNotFoundException
imageIdxFile
- Plain text file that contains space delimited image
paths and labelsFileNotFoundException
- if imageIdxFile was not foundpublic void loadImages(File imageIdxFile, int numOfImages) throws DeepNettsException
imageIdxFile
- Plain text file which contains space delimited image
file paths and labelnumOfImages
- number of images to loadDeepNettsException
public int getLabelsCount()
public ImageSet[] split(double... partSizes)
split
in interface javax.visrec.ml.data.DataSet<ExampleImage>
split
in class TabularDataSet<ExampleImage>
partSizes
- sizes of the parts in percentspublic String[] loadLabels(String filePath) throws DeepNettsException
filePath
- DeepNettsException
public String[] loadLabels(File file) throws DeepNettsException
file
- file to load labels fromDeepNettsException
public Tensor zeroMean()
public boolean getScaleImages()
public final void setScaleImages(boolean scaleImages)
public boolean getInvertImages()
public void setInvertImages(boolean invertImages)
public boolean getFlipHorizontal()
public boolean getBrightness()
public boolean getGrayscale()
public void setFlipHorizontal(boolean flipHorizontal)
public void setBrightness(boolean brightness)
public void setGrayscale(boolean grayscale)
public boolean getTranslate()
public void setTranslate(boolean translate)
public boolean getCropCornersAndCenter()
public void setCropCornersAndCenter(boolean cropCornersAndCenter)
public String[] getTargetColumnsNames()
getTargetColumnsNames
in interface javax.visrec.ml.data.DataSet<ExampleImage>
getTargetColumnsNames
in class TabularDataSet<ExampleImage>
public String getDelimiter()
public void setDelimiter(String delimiter)
public ImageResize getResizeStrategy()
public void setResizeStrategy(ImageResize resizeStrategy)
public Tensor getMean()
public boolean getZeroMeanPixels()
Copyright © 2022. All rights reserved.