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
Coco image detection dataset from http://cocodataset.org/#home.
Coco is a large-scale object detection, segmentation, and captioning dataset although only object detection is implemented at thsi time. It contains 1.5 million object instances and is one of the standard benchmark object detection datasets.
To use this dataset, you have to manually add
com.twelvemonkeys.imageio:imageio-jpeg:3.11.0 as a dependency in your project.
Each image might have different Shapes.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class ai.djl.basicdataset.cv.ImageDataset
ImageDataset.BaseBuilder<T extends ImageDataset.BaseBuilder<T>>Nested classes/interfaces inherited from interface ai.djl.training.dataset.Dataset
ai.djl.training.dataset.Dataset.Usage -
Field Summary
Fields inherited from class ai.djl.basicdataset.cv.ImageDataset
flagFields inherited from class ai.djl.training.dataset.RandomAccessDataset
dataBatchifier, device, labelBatchifier, limit, pipeline, prefetchNumber, sampler, targetPipeline -
Method Summary
Modifier and TypeMethodDescriptionprotected longstatic CocoDetection.Builderbuilder()Creates a builder to build aCocoDetection.Returns the classes that detected objects in the dataset can be classified into.protected ai.djl.modality.cv.ImagegetImage(long index) Returns the image at the given index in the dataset.Returns the height of the images in the dataset.Returns the width of the images in the dataset.ai.djl.util.PairList<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
getMethods inherited from class ai.djl.basicdataset.cv.ImageDataset
getImageChannels, getRecordImageMethods inherited from class ai.djl.training.dataset.RandomAccessDataset
getData, getData, getData, getData, newSubDataset, newSubDataset, randomSplit, size, subDataset, subDataset, subDataset, subDataset, toArrayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ai.djl.training.dataset.Dataset
matchingTranslatorOptions, prepare
-
Method Details
-
builder
Creates a builder to build aCocoDetection.- Returns:
- a new builder
-
getObjects
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.
-
getClasses
Returns the classes that detected objects in the dataset can be classified into.- Specified by:
getClassesin classObjectDetectionDataset- Returns:
- the classes that detected objects in the dataset can be classified into.
-
prepare
- Throws:
IOException
-
availableSize
protected long availableSize()- Specified by:
availableSizein classai.djl.training.dataset.RandomAccessDataset
-
getImage
Description 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:
IOException- if the image could not be loaded
-
getImageWidth
Returns the width of the images in the dataset.- Specified by:
getImageWidthin classImageDataset- Returns:
- the width of the images in the dataset
-
getImageHeight
Returns the height of the images in the dataset.- Specified by:
getImageHeightin classImageDataset- Returns:
- the height of the images in the dataset
-