anatools.annotations.annotations module¶
- class annotations¶
Bases:
object
Generates annotations given a dataset directory, an output directory and mapping file. The dataset directory must include the Ana annotations, images and metadata folders. Examples of mapfiles are in the example channel at /ana/channels/example/mapfiles/.
- bounding_box_2d(image_path, out_dir, object_ids=None, object_types=None, line_thickness=1)¶
Generates images annotated with 2d bounding boxes for datasets downloaded from the Platform. Optional filter on object_ids or object_types (must choose a single filter).
- Parameters
image_path (str) – Path to of specific image file to draw the boxes for.
out_dir (str) – File path to directory where the image should be saved to.
object_ids (list[int]) – List of object id’s to annotate. If not provided, all objects will get annotated. Choose either id or type filter.
object_types (list[str]) – Filter for the object types to annotate. If not provided, all object types will get annotated. Choose either id or type filter.
line_thickness (int) – Desired line thickness for box outline.
- bounding_box_3d(image_path, out_dir, object_ids=None, object_types=None, line_thickness=1)¶
Generates images annotated with 3d bounding boxes for datasets downloaded from the Platform. Optional filter on object_ids or object_types (must choose a single filter).
- Parameters
image_path (str) – Path to of specific image file to draw the boxes for.
out_dir (str) – File path to directory where the image should be saved to.
object_ids (list[int]) – List of object id’s to annotate. If not provided, all objects will get annotated. Choose either id or type filter.
object_types (list[str]) – Filter for the object types to annotate. If not provided, all object types will get annotated. Choose either id or type filter.
line_thickness (int) – Desired line thickness for box outline.
- dump_coco(datadir, outdir, mapfile)¶
Generates annotations in the format of COCO Object Detection. See https://cocodataset.org/#format-data.
- Parameters
datadir (str) – The location of the Ana dataset.
outdir (str) – The location to output the annotation files to.
mapfile (str) – The location of the mapping file.
- dump_kitti(datadir, outdir, mapfile)¶
Generates annotations in the format of KITTI. See https://docs.nvidia.com/metropolis/TLT/archive/tlt-20/tlt-user-guide/text/preparing_data_input.html.
- Parameters
datadir (str) – The location of the Ana dataset.
outdir (str) – The location to output the annotation files to.
mapfile (str) – The location of the mapping file.
- dump_pascal(datadir, outdir, mapfile)¶
Generates annotations in the format of PASCAL VOC. See https://pjreddie.com/media/files/VOC2012_doc.pdf.
- Parameters
datadir (str) – The location of the Ana dataset.
outdir (str) – The location to output the annotation files to.
mapfile (str) – The location of the mapping file.
- dump_sagemaker_od(datadir, outdir, mapfile)¶
Generates annotations in the format of Sagemaker Object Detection. See https://docs.aws.amazon.com/sagemaker/latest/dg/object-detection.html.
- Parameters
datadir (str) – The location of the Ana dataset.
outdir (str) – The location to output the annotation files to.
mapfile (str) – The location of the mapping file.
- dump_sagemaker_ss(datadir, outdir, mapfile)¶
Generates annotations in the format of Sagemaker Semantic Segmentation. See https://docs.aws.amazon.com/sagemaker/latest/dg/semantic-segmentation.html.
- Parameters
datadir (str) – The location of the Ana dataset.
outdir (str) – The location to output the annotation files to.
mapfile (str) – The location of the mapping file.
- dump_yolo(datadir, outdir, mapfile)¶
Generates annotations in the format of YOLO Object Detection.
- Parameters
datadir (str) – The location of the Ana dataset.
outdir (str) – The location to output the annotation files to.
mapfile (str) – The location of the mapping file.
- segmentation(image_path, out_dir, object_ids=None, object_types=None, line_thickness=1)¶
Generates images annotated with outlines around objects for datasets downloaded from the Platform. Optional filter on object_ids or object_types (must choose a single filter).
- Parameters
image_path (str) – Path to of specific image file to draw the boxes for.
out_dir (str) – File path to directory where the image should be saved to.
object_ids (list[int]) – List of object id’s to annotate. If not provided, all objects will get annotated. Choose either id or type filter.
object_types (list[str]) – Filter for the object types to annotate. If not provided, all object types will get annotated. Choose either id or type filter.
line_thickness (int) – Desired line thickness for object segmentation outline.