Python object_detection.utils.category_util.load_categories_from_csv_file() Examples

The following are 30 code examples of object_detection.utils.category_util.load_categories_from_csv_file(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module object_detection.utils.category_util , or try the search function .
Example #1
Source File: category_util_test.py    From AniSeg with Apache License 2.0 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #2
Source File: category_util_test.py    From hands-detection with MIT License 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #3
Source File: category_util_test.py    From hands-detection with MIT License 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #4
Source File: category_util_test.py    From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #5
Source File: category_util_test.py    From Live-feed-object-device-identification-using-Tensorflow-and-OpenCV with Apache License 2.0 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #6
Source File: category_util_test.py    From object_detection_kitti with Apache License 2.0 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #7
Source File: category_util_test.py    From object_detection_kitti with Apache License 2.0 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #8
Source File: category_util_test.py    From MBMD with MIT License 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #9
Source File: category_util_test.py    From MBMD with MIT License 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #10
Source File: category_util_test.py    From Elphas with Apache License 2.0 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #11
Source File: category_util_test.py    From Elphas with Apache License 2.0 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #12
Source File: category_util_test.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #13
Source File: category_util_test.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #14
Source File: category_util_test.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #15
Source File: category_util_test.py    From object_detection_with_tensorflow with MIT License 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #16
Source File: category_util_test.py    From moveo_ros with MIT License 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #17
Source File: category_util_test.py    From AniSeg with Apache License 2.0 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #18
Source File: category_util_test.py    From MAX-Object-Detector with Apache License 2.0 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #19
Source File: category_util_test.py    From MAX-Object-Detector with Apache License 2.0 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #20
Source File: category_util_test.py    From g-tensorflow-models with Apache License 2.0 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #21
Source File: category_util_test.py    From g-tensorflow-models with Apache License 2.0 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #22
Source File: category_util_test.py    From models with Apache License 2.0 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #23
Source File: category_util_test.py    From models with Apache License 2.0 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #24
Source File: category_util_test.py    From motion-rcnn with MIT License 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #25
Source File: category_util_test.py    From motion-rcnn with MIT License 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #26
Source File: category_util_test.py    From mtl-ssl with Apache License 2.0 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #27
Source File: category_util_test.py    From mtl-ssl with Apache License 2.0 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #28
Source File: category_util_test.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def test_load_categories_from_csv_file(self):
    csv_data = """
        0,"cat"
        1,"dog"
        2,"bird"
    """.strip(' ')
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    with tf.gfile.Open(csv_path, 'wb') as f:
      f.write(csv_data)

    categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertTrue({'id': 0, 'name': 'cat'} in categories)
    self.assertTrue({'id': 1, 'name': 'dog'} in categories)
    self.assertTrue({'id': 2, 'name': 'bird'} in categories) 
Example #29
Source File: category_util_test.py    From multilabel-image-classification-tensorflow with MIT License 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories) 
Example #30
Source File: category_util_test.py    From yolo_v2 with Apache License 2.0 5 votes vote down vote up
def test_save_categories_to_csv_file(self):
    categories = [
        {'id': 0, 'name': 'cat'},
        {'id': 1, 'name': 'dog'},
        {'id': 2, 'name': 'bird'},
    ]
    csv_path = os.path.join(self.get_temp_dir(), 'test.csv')
    category_util.save_categories_to_csv_file(categories, csv_path)
    saved_categories = category_util.load_categories_from_csv_file(csv_path)
    self.assertEqual(saved_categories, categories)