Package ai.djl.basicdataset.cv
Class CocoDetection
- java.lang.Object
-
- ai.djl.training.dataset.RandomAccessDataset
-
- ai.djl.basicdataset.cv.ImageDataset
-
- ai.djl.basicdataset.cv.ObjectDetectionDataset
-
- ai.djl.basicdataset.cv.CocoDetection
-
- All Implemented Interfaces:
ai.djl.training.dataset.Dataset
public class CocoDetection extends ObjectDetectionDataset
Coco image detection dataset from http://cocodataset.org/#home.Each image might have different
Shapes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCocoDetection.BuilderA builder to construct aCocoDetection.-
Nested classes/interfaces inherited from class ai.djl.basicdataset.cv.ImageDataset
ImageDataset.BaseBuilder<T extends ImageDataset.BaseBuilder<T>>
-
-
Field Summary
-
Fields inherited from class ai.djl.basicdataset.cv.ImageDataset
flag
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected longavailableSize()static CocoDetection.Builderbuilder()Creates a builder to build aCocoDetection.protected ai.djl.modality.cv.ImagegetImage(long index)Returns the image at the given index in the dataset.java.util.Optional<java.lang.Integer>getImageHeight()Returns the height of the images in the dataset.java.util.Optional<java.lang.Integer>getImageWidth()Returns the width of the images in the dataset.ai.djl.util.PairList<java.lang.Long,ai.djl.modality.cv.output.Rectangle>getObjects(long index)Returns the list of objects in the image at the given index.voidprepare(ai.djl.util.Progress progress)-
Methods inherited from class ai.djl.basicdataset.cv.ObjectDetectionDataset
get
-
Methods inherited from class ai.djl.basicdataset.cv.ImageDataset
getImageChannels, getRecordImage
-
Methods inherited from class ai.djl.training.dataset.RandomAccessDataset
getData, getData, getData, getData, randomSplit, size, subDataset, toArray
-
-
-
-
Method Detail
-
builder
public static CocoDetection.Builder builder()
Creates a builder to build aCocoDetection.- Returns:
- a new builder
-
getObjects
public ai.djl.util.PairList<java.lang.Long,ai.djl.modality.cv.output.Rectangle> getObjects(long index)
Returns the list of objects in the image at the given index.- Specified by:
getObjectsin classObjectDetectionDataset- Parameters:
index- the index (if the dataset is a list of data items)- Returns:
- the list of objects in the image. The long is the class number of the index into the list of classes of the desired class name. The rectangle is the location of the object inside the image.
-
prepare
public void prepare(ai.djl.util.Progress progress) throws java.io.IOException- Throws:
java.io.IOException
-
availableSize
protected long availableSize()
- Specified by:
availableSizein classai.djl.training.dataset.RandomAccessDataset
-
getImage
protected ai.djl.modality.cv.Image getImage(long index) throws java.io.IOExceptionDescription copied from class:ImageDatasetReturns the image at the given index in the dataset.- Specified by:
getImagein classImageDataset- Parameters:
index- the index (if the dataset is a list of data items)- Returns:
- the image
- Throws:
java.io.IOException- if the image could not be loaded
-
getImageWidth
public java.util.Optional<java.lang.Integer> getImageWidth()
Returns the width of the images in the dataset.- Specified by:
getImageWidthin classImageDataset- Returns:
- the width of the images in the dataset
-
getImageHeight
public java.util.Optional<java.lang.Integer> getImageHeight()
Returns the height of the images in the dataset.- Specified by:
getImageHeightin classImageDataset- Returns:
- the height of the images in the dataset
-
-