Package ai.djl.basicdataset.cv
Class BananaDetection
java.lang.Object
ai.djl.training.dataset.RandomAccessDataset
ai.djl.basicdataset.cv.ImageDataset
ai.djl.basicdataset.cv.ObjectDetectionDataset
ai.djl.basicdataset.cv.BananaDetection
- All Implemented Interfaces:
ai.djl.training.dataset.Dataset
Banana image detection dataset contains a 3 x 256 x 256 image in the dataset with a banana of
varying sizes in each image. There are 1000 training images and 100 testing images.
-
Nested Class Summary
Nested 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
flag
Fields inherited from class ai.djl.training.dataset.RandomAccessDataset
dataBatchifier, device, labelBatchifier, limit, pipeline, prefetchNumber, sampler, targetPipeline
-
Constructor Summary
ConstructorDescriptionBananaDetection
(BananaDetection.Builder builder) Creates a new instance ofRandomAccessDataset
with the given necessary configurations. -
Method Summary
Modifier and TypeMethodDescriptionprotected long
static BananaDetection.Builder
builder()
Creates a new builder to build aBananaDetection
.Returns the classes that detected objects in the dataset can be classified into.protected ai.djl.modality.cv.Image
getImage
(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.void
prepare
(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, newSubDataset, newSubDataset, randomSplit, size, subDataset, subDataset, subDataset, subDataset, toArray
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ai.djl.training.dataset.Dataset
matchingTranslatorOptions, prepare
-
Constructor Details
-
BananaDetection
Creates a new instance ofRandomAccessDataset
with the given necessary configurations.- Parameters:
builder
- a builder with the necessary configurations
-
-
Method Details
-
builder
Creates a new builder to build aBananaDetection
.- Returns:
- a new builder
-
getObjects
Returns the list of objects in the image at the given index.- Specified by:
getObjects
in 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:
getClasses
in classObjectDetectionDataset
- Returns:
- the classes that detected objects in the dataset can be classified into.
-
availableSize
protected long availableSize()- Specified by:
availableSize
in classai.djl.training.dataset.RandomAccessDataset
-
prepare
public void prepare(ai.djl.util.Progress progress) throws IOException, ai.djl.translate.TranslateException - Throws:
IOException
ai.djl.translate.TranslateException
-
getImage
Returns the image at the given index in the dataset.- Specified by:
getImage
in 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:
getImageWidth
in classImageDataset
- Returns:
- the width of the images in the dataset
-
getImageHeight
Returns the height of the images in the dataset.- Specified by:
getImageHeight
in classImageDataset
- Returns:
- the height of the images in the dataset
-