How to work with COCO object detection datasets in Tensorflow?


I’m super new to this topic of object detection and TensorFlow and I was wondering how can I load this file as a TensorFlow dataset? I’ve used pandas to read it as a DataFrame but I can’t parse it to a TensorFlow dataset. I’ve tried this

train_ds =
    tf.cast(dataframe['file'].values, tf.string),
    tf.cast(dataframe['width'].values, tf.int8),
    tf.cast(dataframe['height'].values, tf.int8)
    # tf.cast(dataframe['annotations'].values, tf.string)
    # here I want to cast the annotations to the dataset but I don't 
    # know how

but could not figure out how to get the annotations to work here… Any help with that?


Looks like your data is in JSON format,
Directly use library to read the json values.

import tensorflow as tf[
    [example_json, example_json],
    [example_json, example_json]]).shape.as_list()

For more details on the library find here.

Answered By – TFer

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published