public class CocoUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
CocoMetadata.Annotation |
getAnnotationById(long annotationId)
Returns an
CocoMetadata.Annotation that corresponds to a given
annotation id. |
java.util.List<java.lang.Long> |
getAnnotationIdByImageId(long imageId)
Returns all ids of the annotation that correspond to a given image id.
|
java.util.List<java.lang.Long> |
getImageIds()
Returns all image ids in the annotation file.
|
java.nio.file.Path |
getRelativeImagePath(long imageId)
Returns the relative path of an image given an image id.
|
int |
mapCategoryId(long originalCategoryId)
Returns the continuous category id given an original category id.
|
void |
prepare()
Prepares and indexes the annotation file in memory.
|
public void prepare() throws java.io.IOException
java.io.IOException
- if reading the annotation file failspublic java.util.List<java.lang.Long> getImageIds()
public java.nio.file.Path getRelativeImagePath(long imageId)
imageId
- the image id to retrieve the path forpublic java.util.List<java.lang.Long> getAnnotationIdByImageId(long imageId)
imageId
- the image id to retrieve annotations forpublic CocoMetadata.Annotation getAnnotationById(long annotationId)
CocoMetadata.Annotation
that corresponds to a given
annotation id.annotationId
- the annotation id to retrieve an annotation forCocoMetadata.Annotation
public int mapCategoryId(long originalCategoryId)
originalCategoryId
- the original category id to retrieve the continuous category id for