Commit 8cf8446b authored by Yukun Zhu's avatar Yukun Zhu Committed by aquariusjay
Browse files

Adding panoptic evaluation tools and update internal changes. (#6320)

* Internal changes

PiperOrigin-RevId: 237183552

* update readme

PiperOrigin-RevId: 237184584
parent 05a79f5a
# Copyright 2019 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for segmentation "streaming" metrics."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import numpy as np
import six
import tensorflow as tf
from deeplab.evaluation import streaming_metrics
from deeplab.evaluation import test_utils
# See the definition of the color names at:
# https://en.wikipedia.org/wiki/Web_colors.
_CLASS_COLOR_MAP = {
(0, 0, 0): 0,
(0, 0, 255): 1, # Person (blue).
(255, 0, 0): 2, # Bear (red).
(0, 255, 0): 3, # Tree (lime).
(255, 0, 255): 4, # Bird (fuchsia).
(0, 255, 255): 5, # Sky (aqua).
(255, 255, 0): 6, # Cat (yellow).
}
class StreamingPanopticQualityTest(tf.test.TestCase):
def test_streaming_metric_on_single_image(self):
offset = 256 * 256
instance_class_map = {
0: 0,
47: 1,
97: 1,
133: 1,
150: 1,
174: 1,
198: 2,
215: 1,
244: 1,
255: 1,
}
gt_instances, gt_classes = test_utils.panoptic_segmentation_with_class_map(
'team_gt_instance.png', instance_class_map)
pred_classes = test_utils.read_segmentation_with_rgb_color_map(
'team_pred_class.png', _CLASS_COLOR_MAP)
pred_instances = test_utils.read_test_image(
'team_pred_instance.png', mode='L')
gt_class_tensor = tf.placeholder(tf.uint16)
gt_instance_tensor = tf.placeholder(tf.uint16)
pred_class_tensor = tf.placeholder(tf.uint16)
pred_instance_tensor = tf.placeholder(tf.uint16)
qualities, update_pq = streaming_metrics.streaming_panoptic_quality(
gt_class_tensor,
gt_instance_tensor,
pred_class_tensor,
pred_instance_tensor,
num_classes=3,
max_instances_per_category=256,
ignored_label=0,
offset=offset)
pq, sq, rq, total_tp, total_fn, total_fp = tf.unstack(qualities, 6, axis=0)
feed_dict = {
gt_class_tensor: gt_classes,
gt_instance_tensor: gt_instances,
pred_class_tensor: pred_classes,
pred_instance_tensor: pred_instances
}
with self.session() as sess:
sess.run(tf.local_variables_initializer())
sess.run(update_pq, feed_dict=feed_dict)
(result_pq, result_sq, result_rq, result_total_tp, result_total_fn,
result_total_fp) = sess.run([pq, sq, rq, total_tp, total_fn, total_fp],
feed_dict=feed_dict)
np.testing.assert_array_almost_equal(
result_pq, [2.06104, 0.7024, 0.54069], decimal=4)
np.testing.assert_array_almost_equal(
result_sq, [2.06104, 0.7526, 0.54069], decimal=4)
np.testing.assert_array_almost_equal(result_rq, [1., 0.9333, 1.], decimal=4)
np.testing.assert_array_almost_equal(
result_total_tp, [1., 7., 1.], decimal=4)
np.testing.assert_array_almost_equal(
result_total_fn, [0., 1., 0.], decimal=4)
np.testing.assert_array_almost_equal(
result_total_fp, [0., 0., 0.], decimal=4)
def test_streaming_metric_on_multiple_images(self):
num_classes = 7
offset = 256 * 256
bird_gt_instance_class_map = {
92: 5,
176: 3,
255: 4,
}
cat_gt_instance_class_map = {
0: 0,
255: 6,
}
team_gt_instance_class_map = {
0: 0,
47: 1,
97: 1,
133: 1,
150: 1,
174: 1,
198: 2,
215: 1,
244: 1,
255: 1,
}
test_image = collections.namedtuple(
'TestImage',
['gt_class_map', 'gt_path', 'pred_inst_path', 'pred_class_path'])
test_images = [
test_image(bird_gt_instance_class_map, 'bird_gt.png',
'bird_pred_instance.png', 'bird_pred_class.png'),
test_image(cat_gt_instance_class_map, 'cat_gt.png',
'cat_pred_instance.png', 'cat_pred_class.png'),
test_image(team_gt_instance_class_map, 'team_gt_instance.png',
'team_pred_instance.png', 'team_pred_class.png'),
]
gt_classes = []
gt_instances = []
pred_classes = []
pred_instances = []
for test_image in test_images:
(image_gt_instances,
image_gt_classes) = test_utils.panoptic_segmentation_with_class_map(
test_image.gt_path, test_image.gt_class_map)
gt_classes.append(image_gt_classes)
gt_instances.append(image_gt_instances)
pred_classes.append(
test_utils.read_segmentation_with_rgb_color_map(
test_image.pred_class_path, _CLASS_COLOR_MAP))
pred_instances.append(
test_utils.read_test_image(test_image.pred_inst_path, mode='L'))
gt_class_tensor = tf.placeholder(tf.uint16)
gt_instance_tensor = tf.placeholder(tf.uint16)
pred_class_tensor = tf.placeholder(tf.uint16)
pred_instance_tensor = tf.placeholder(tf.uint16)
qualities, update_pq = streaming_metrics.streaming_panoptic_quality(
gt_class_tensor,
gt_instance_tensor,
pred_class_tensor,
pred_instance_tensor,
num_classes=num_classes,
max_instances_per_category=256,
ignored_label=0,
offset=offset)
pq, sq, rq, total_tp, total_fn, total_fp = tf.unstack(qualities, 6, axis=0)
with self.session() as sess:
sess.run(tf.local_variables_initializer())
for pred_class, pred_instance, gt_class, gt_instance in six.moves.zip(
pred_classes, pred_instances, gt_classes, gt_instances):
sess.run(
update_pq,
feed_dict={
gt_class_tensor: gt_class,
gt_instance_tensor: gt_instance,
pred_class_tensor: pred_class,
pred_instance_tensor: pred_instance
})
(result_pq, result_sq, result_rq, result_total_tp, result_total_fn,
result_total_fp) = sess.run(
[pq, sq, rq, total_tp, total_fn, total_fp],
feed_dict={
gt_class_tensor: 0,
gt_instance_tensor: 0,
pred_class_tensor: 0,
pred_instance_tensor: 0
})
np.testing.assert_array_almost_equal(
result_pq,
[4.3107, 0.7024, 0.54069, 0.745353, 0.85768, 0.99107, 0.77410],
decimal=4)
np.testing.assert_array_almost_equal(
result_sq, [5.3883, 0.7526, 0.5407, 0.7454, 0.8577, 0.9911, 0.7741],
decimal=4)
np.testing.assert_array_almost_equal(
result_rq, [0.8, 0.9333, 1., 1., 1., 1., 1.], decimal=4)
np.testing.assert_array_almost_equal(
result_total_tp, [2., 7., 1., 1., 1., 1., 1.], decimal=4)
np.testing.assert_array_almost_equal(
result_total_fn, [0., 1., 0., 0., 0., 0., 0.], decimal=4)
np.testing.assert_array_almost_equal(
result_total_fp, [1., 0., 0., 0., 0., 0., 0.], decimal=4)
class StreamingParsingCoveringTest(tf.test.TestCase):
def test_streaming_metric_on_single_image(self):
offset = 256 * 256
instance_class_map = {
0: 0,
47: 1,
97: 1,
133: 1,
150: 1,
174: 1,
198: 2,
215: 1,
244: 1,
255: 1,
}
gt_instances, gt_classes = test_utils.panoptic_segmentation_with_class_map(
'team_gt_instance.png', instance_class_map)
pred_classes = test_utils.read_segmentation_with_rgb_color_map(
'team_pred_class.png', _CLASS_COLOR_MAP)
pred_instances = test_utils.read_test_image(
'team_pred_instance.png', mode='L')
gt_class_tensor = tf.placeholder(tf.uint16)
gt_instance_tensor = tf.placeholder(tf.uint16)
pred_class_tensor = tf.placeholder(tf.uint16)
pred_instance_tensor = tf.placeholder(tf.uint16)
coverings, update_ops = streaming_metrics.streaming_parsing_covering(
gt_class_tensor,
gt_instance_tensor,
pred_class_tensor,
pred_instance_tensor,
num_classes=3,
max_instances_per_category=256,
ignored_label=0,
offset=offset,
normalize_by_image_size=False)
(per_class_coverings, per_class_weighted_ious, per_class_gt_areas) = (
tf.unstack(coverings, num=3, axis=0))
feed_dict = {
gt_class_tensor: gt_classes,
gt_instance_tensor: gt_instances,
pred_class_tensor: pred_classes,
pred_instance_tensor: pred_instances
}
with self.session() as sess:
sess.run(tf.local_variables_initializer())
sess.run(update_ops, feed_dict=feed_dict)
(result_per_class_coverings, result_per_class_weighted_ious,
result_per_class_gt_areas) = (
sess.run([
per_class_coverings,
per_class_weighted_ious,
per_class_gt_areas,
],
feed_dict=feed_dict))
np.testing.assert_array_almost_equal(
result_per_class_coverings, [0.0, 0.7009696912, 0.5406896552],
decimal=4)
np.testing.assert_array_almost_equal(
result_per_class_weighted_ious, [0.0, 39864.14634, 3136], decimal=4)
np.testing.assert_array_equal(result_per_class_gt_areas, [0, 56870, 5800])
def test_streaming_metric_on_multiple_images(self):
"""Tests streaming parsing covering metric."""
num_classes = 7
offset = 256 * 256
bird_gt_instance_class_map = {
92: 5,
176: 3,
255: 4,
}
cat_gt_instance_class_map = {
0: 0,
255: 6,
}
team_gt_instance_class_map = {
0: 0,
47: 1,
97: 1,
133: 1,
150: 1,
174: 1,
198: 2,
215: 1,
244: 1,
255: 1,
}
test_image = collections.namedtuple(
'TestImage',
['gt_class_map', 'gt_path', 'pred_inst_path', 'pred_class_path'])
test_images = [
test_image(bird_gt_instance_class_map, 'bird_gt.png',
'bird_pred_instance.png', 'bird_pred_class.png'),
test_image(cat_gt_instance_class_map, 'cat_gt.png',
'cat_pred_instance.png', 'cat_pred_class.png'),
test_image(team_gt_instance_class_map, 'team_gt_instance.png',
'team_pred_instance.png', 'team_pred_class.png'),
]
gt_classes = []
gt_instances = []
pred_classes = []
pred_instances = []
for test_image in test_images:
(image_gt_instances,
image_gt_classes) = test_utils.panoptic_segmentation_with_class_map(
test_image.gt_path, test_image.gt_class_map)
gt_classes.append(image_gt_classes)
gt_instances.append(image_gt_instances)
pred_instances.append(
test_utils.read_test_image(test_image.pred_inst_path, mode='L'))
pred_classes.append(
test_utils.read_segmentation_with_rgb_color_map(
test_image.pred_class_path, _CLASS_COLOR_MAP))
gt_class_tensor = tf.placeholder(tf.uint16)
gt_instance_tensor = tf.placeholder(tf.uint16)
pred_class_tensor = tf.placeholder(tf.uint16)
pred_instance_tensor = tf.placeholder(tf.uint16)
coverings, update_ops = streaming_metrics.streaming_parsing_covering(
gt_class_tensor,
gt_instance_tensor,
pred_class_tensor,
pred_instance_tensor,
num_classes=num_classes,
max_instances_per_category=256,
ignored_label=0,
offset=offset,
normalize_by_image_size=False)
(per_class_coverings, per_class_weighted_ious, per_class_gt_areas) = (
tf.unstack(coverings, num=3, axis=0))
with self.session() as sess:
sess.run(tf.local_variables_initializer())
for pred_class, pred_instance, gt_class, gt_instance in six.moves.zip(
pred_classes, pred_instances, gt_classes, gt_instances):
sess.run(
update_ops,
feed_dict={
gt_class_tensor: gt_class,
gt_instance_tensor: gt_instance,
pred_class_tensor: pred_class,
pred_instance_tensor: pred_instance
})
(result_per_class_coverings, result_per_class_weighted_ious,
result_per_class_gt_areas) = (
sess.run(
[
per_class_coverings,
per_class_weighted_ious,
per_class_gt_areas,
],
feed_dict={
gt_class_tensor: 0,
gt_instance_tensor: 0,
pred_class_tensor: 0,
pred_instance_tensor: 0
}))
np.testing.assert_array_almost_equal(
result_per_class_coverings, [
0.0,
0.7009696912,
0.5406896552,
0.7453531599,
0.8576779026,
0.9910687881,
0.7741046032,
],
decimal=4)
np.testing.assert_array_almost_equal(
result_per_class_weighted_ious, [
0.0,
39864.14634,
3136,
1177.657993,
2498.41573,
33366.31289,
26671,
],
decimal=4)
np.testing.assert_array_equal(result_per_class_gt_areas, [
0.0,
56870,
5800,
1580,
2913,
33667,
34454,
])
def test_streaming_metric_on_multiple_images_normalize_by_size(self):
"""Tests streaming parsing covering metric with image size normalization."""
num_classes = 7
offset = 256 * 256
bird_gt_instance_class_map = {
92: 5,
176: 3,
255: 4,
}
cat_gt_instance_class_map = {
0: 0,
255: 6,
}
team_gt_instance_class_map = {
0: 0,
47: 1,
97: 1,
133: 1,
150: 1,
174: 1,
198: 2,
215: 1,
244: 1,
255: 1,
}
test_image = collections.namedtuple(
'TestImage',
['gt_class_map', 'gt_path', 'pred_inst_path', 'pred_class_path'])
test_images = [
test_image(bird_gt_instance_class_map, 'bird_gt.png',
'bird_pred_instance.png', 'bird_pred_class.png'),
test_image(cat_gt_instance_class_map, 'cat_gt.png',
'cat_pred_instance.png', 'cat_pred_class.png'),
test_image(team_gt_instance_class_map, 'team_gt_instance.png',
'team_pred_instance.png', 'team_pred_class.png'),
]
gt_classes = []
gt_instances = []
pred_classes = []
pred_instances = []
for test_image in test_images:
(image_gt_instances,
image_gt_classes) = test_utils.panoptic_segmentation_with_class_map(
test_image.gt_path, test_image.gt_class_map)
gt_classes.append(image_gt_classes)
gt_instances.append(image_gt_instances)
pred_instances.append(
test_utils.read_test_image(test_image.pred_inst_path, mode='L'))
pred_classes.append(
test_utils.read_segmentation_with_rgb_color_map(
test_image.pred_class_path, _CLASS_COLOR_MAP))
gt_class_tensor = tf.placeholder(tf.uint16)
gt_instance_tensor = tf.placeholder(tf.uint16)
pred_class_tensor = tf.placeholder(tf.uint16)
pred_instance_tensor = tf.placeholder(tf.uint16)
coverings, update_ops = streaming_metrics.streaming_parsing_covering(
gt_class_tensor,
gt_instance_tensor,
pred_class_tensor,
pred_instance_tensor,
num_classes=num_classes,
max_instances_per_category=256,
ignored_label=0,
offset=offset,
normalize_by_image_size=True)
(per_class_coverings, per_class_weighted_ious, per_class_gt_areas) = (
tf.unstack(coverings, num=3, axis=0))
with self.session() as sess:
sess.run(tf.local_variables_initializer())
for pred_class, pred_instance, gt_class, gt_instance in six.moves.zip(
pred_classes, pred_instances, gt_classes, gt_instances):
sess.run(
update_ops,
feed_dict={
gt_class_tensor: gt_class,
gt_instance_tensor: gt_instance,
pred_class_tensor: pred_class,
pred_instance_tensor: pred_instance
})
(result_per_class_coverings, result_per_class_weighted_ious,
result_per_class_gt_areas) = (
sess.run(
[
per_class_coverings,
per_class_weighted_ious,
per_class_gt_areas,
],
feed_dict={
gt_class_tensor: 0,
gt_instance_tensor: 0,
pred_class_tensor: 0,
pred_instance_tensor: 0
}))
np.testing.assert_array_almost_equal(
result_per_class_coverings, [
0.0,
0.7009696912,
0.5406896552,
0.7453531599,
0.8576779026,
0.9910687881,
0.7741046032,
],
decimal=4)
np.testing.assert_array_almost_equal(
result_per_class_weighted_ious, [
0.0,
0.5002088756,
0.03935002196,
0.03086105851,
0.06547211033,
0.8743792686,
0.2549565051,
],
decimal=4)
np.testing.assert_array_almost_equal(
result_per_class_gt_areas, [
0.0,
0.7135955832,
0.07277746408,
0.04140461216,
0.07633647799,
0.8822589099,
0.3293566581,
],
decimal=4)
if __name__ == '__main__':
tf.test.main()
# Copyright 2019 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Utility functions to set up unit tests on Panoptic Segmentation code."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from absl import flags
import numpy as np
import scipy.misc
import six
FLAGS = flags.FLAGS
_TEST_DIR = 'deeplab/evaluation/testdata'
def read_test_image(testdata_path, *args, **kwargs):
"""Loads a test image.
Args:
testdata_path: Image path relative to panoptic_segmentation/testdata as a
string.
*args: Additional positional arguments passed to `imread`.
**kwargs: Additional keyword arguments passed to `imread`.
Returns:
The image, as a numpy array.
"""
image_path = os.path.join(_TEST_DIR, testdata_path)
return scipy.misc.imread(image_path, *args, **kwargs)
def read_segmentation_with_rgb_color_map(image_testdata_path,
rgb_to_semantic_label,
output_dtype=None):
"""Reads a test segmentation as an image and a map from colors to labels.
Args:
image_testdata_path: Image path relative to panoptic_segmentation/testdata
as a string.
rgb_to_semantic_label: Mapping from RGB colors to integer labels as a
dictionary.
output_dtype: Type of the output labels. If None, defaults to the type of
the provided color map.
Returns:
A 2D numpy array of labels.
Raises:
ValueError: On an incomplete `rgb_to_semantic_label`.
"""
rgb_image = read_test_image(image_testdata_path, mode='RGB')
if len(rgb_image.shape) != 3 or rgb_image.shape[2] != 3:
raise AssertionError(
'Expected RGB image, actual shape is %s' % rgb_image.sape)
num_pixels = rgb_image.shape[0] * rgb_image.shape[1]
unique_colors = np.unique(np.reshape(rgb_image, [num_pixels, 3]), axis=0)
if not set(map(tuple, unique_colors)).issubset(
six.viewkeys(rgb_to_semantic_label)):
raise ValueError('RGB image has colors not in color map.')
output_dtype = output_dtype or type(
next(six.itervalues(rgb_to_semantic_label)))
output_labels = np.empty(rgb_image.shape[:2], dtype=output_dtype)
for rgb_color, int_label in six.iteritems(rgb_to_semantic_label):
color_array = np.array(rgb_color, ndmin=3)
output_labels[np.all(rgb_image == color_array, axis=2)] = int_label
return output_labels
def panoptic_segmentation_with_class_map(instance_testdata_path,
instance_label_to_semantic_label):
"""Reads in a panoptic segmentation with an instance map and a map to classes.
Args:
instance_testdata_path: Path to a grayscale instance map, given as a string
and relative to panoptic_segmentation/testdata.
instance_label_to_semantic_label: A map from instance labels to class
labels.
Returns:
A tuple `(instance_labels, class_labels)` of numpy arrays.
Raises:
ValueError: On a mismatched set of instances in
the
`instance_label_to_semantic_label`.
"""
instance_labels = read_test_image(instance_testdata_path, mode='L')
if set(np.unique(instance_labels)) != set(
six.iterkeys(instance_label_to_semantic_label)):
raise ValueError('Provided class map does not match present instance ids.')
class_labels = np.empty_like(instance_labels)
for instance_id, class_id in six.iteritems(instance_label_to_semantic_label):
class_labels[instance_labels == instance_id] = class_id
return instance_labels, class_labels
# Copyright 2019 The TensorFlow Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for test_utils."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import absltest
import numpy as np
from deeplab.evaluation import test_utils
class TestUtilsTest(absltest.TestCase):
def test_read_test_image(self):
image_array = test_utils.read_test_image('team_pred_class.png')
self.assertSequenceEqual(image_array.shape, (231, 345, 4))
def test_reads_segmentation_with_color_map(self):
rgb_to_semantic_label = {(0, 0, 0): 0, (0, 0, 255): 1, (255, 0, 0): 23}
labels = test_utils.read_segmentation_with_rgb_color_map(
'team_pred_class.png', rgb_to_semantic_label)
input_image = test_utils.read_test_image('team_pred_class.png')
np.testing.assert_array_equal(
labels == 0,
np.logical_and(input_image[:, :, 0] == 0, input_image[:, :, 2] == 0))
np.testing.assert_array_equal(labels == 1, input_image[:, :, 2] == 255)
np.testing.assert_array_equal(labels == 23, input_image[:, :, 0] == 255)
def test_reads_gt_segmentation(self):
instance_label_to_semantic_label = {
0: 0,
47: 1,
97: 1,
133: 1,
150: 1,
174: 1,
198: 23,
215: 1,
244: 1,
255: 1,
}
instances, classes = test_utils.panoptic_segmentation_with_class_map(
'team_gt_instance.png', instance_label_to_semantic_label)
expected_label_shape = (231, 345)
self.assertSequenceEqual(instances.shape, expected_label_shape)
self.assertSequenceEqual(classes.shape, expected_label_shape)
np.testing.assert_array_equal(instances == 0, classes == 0)
np.testing.assert_array_equal(instances == 198, classes == 23)
np.testing.assert_array_equal(
np.logical_and(instances != 0, instances != 198), classes == 1)
if __name__ == '__main__':
absltest.main()
# Segmentation Evalaution Test Data
## Source Images
* [team_input.png](team_input.png) \
Source:
https://ai.googleblog.com/2018/03/semantic-image-segmentation-with.html
* [cat_input.jpg](cat_input.jpg) \
Source: https://www.flickr.com/photos/magdalena_b/4995858743
* [bird_input.jpg](bird_input.jpg) \
Source: https://www.flickr.com/photos/chivinskia/40619099560
* [congress_input.jpg](congress_input.jpg) \
Source:
https://cao.house.gov/sites/cao.house.gov/files/documents/SAR-Jan-Jun-2016.pdf
{
"info": {
"description": "Test COCO-format dataset",
"url": "https://github.com/tensorflow/models/tree/master/research/deeplab",
"version": "1.0",
"year": 2019
},
"images": [
{
"id": 1,
"file_name": "bird.jpg",
"height": 159,
"width": 240,
"flickr_url": "https://www.flickr.com/photos/chivinskia/40619099560"
},
{
"id": 2,
"file_name": "cat.jpg",
"height": 330,
"width": 317,
"flickr_url": "https://www.flickr.com/photos/magdalena_b/4995858743"
},
{
"id": 3,
"file_name": "team.jpg",
"height": 231,
"width": 345
},
{
"id": 4,
"file_name": "congress.jpg",
"height": 267,
"width": 525
}
],
"annotations": [
{
"image_id": 1,
"file_name": "bird.png",
"segments_info": [
{
"id": 255,
"area": 2913,
"category_id": 4,
"iscrowd": 0
},
{
"id": 2586368,
"area": 1580,
"category_id": 3,
"iscrowd": 0
},
{
"id": 16770360,
"area": 33667,
"category_id": 5,
"iscrowd": 0
}
]
},
{
"image_id": 2,
"file_name": "cat.png",
"segments_info": [
{
"id": 16711691,
"area": 34454,
"category_id": 6,
"iscrowd": 0
}
]
},
{
"image_id": 3,
"file_name": "team.png",
"segments_info": [
{
"id": 129,
"area": 5443,
"category_id": 1,
"iscrowd": 0
},
{
"id": 255,
"area": 3574,
"category_id": 2,
"iscrowd": 0
},
{
"id": 47615,
"area": 11483,
"category_id": 1,
"iscrowd": 0
},
{
"id": 65532,
"area": 7080,
"category_id": 1,
"iscrowd": 0
},
{
"id": 8585107,
"area": 11363,
"category_id": 1,
"iscrowd": 0
},
{
"id": 9011200,
"area": 7158,
"category_id": 1,
"iscrowd": 0
},
{
"id": 12858027,
"area": 6419,
"category_id": 1,
"iscrowd": 0
},
{
"id": 16053492,
"area": 4350,
"category_id": 1,
"iscrowd": 0
},
{
"id": 16711680,
"area": 5800,
"category_id": 1,
"iscrowd": 0
}
]
},
{
"image_id": 4,
"file_name": "congress.png",
"segments_info": [
{
"id": 255,
"area": 243,
"category_id": 1,
"iscrowd": 0
},
{
"id": 65315,
"area": 553,
"category_id": 1,
"iscrowd": 0
},
{
"id": 65516,
"area": 652,
"category_id": 1,
"iscrowd": 0
},
{
"id": 9895680,
"area": 82774,
"category_id": 1,
"iscrowd": 1
},
{
"id": 16711739,
"area": 137,
"category_id": 1,
"iscrowd": 0
},
{
"id": 16711868,
"area": 179,
"category_id": 1,
"iscrowd": 0
},
{
"id": 16762624,
"area": 2742,
"category_id": 1,
"iscrowd": 0
}
]
}
],
"categories": [
{
"id": 1,
"name": "person",
"isthing": 1
},
{
"id": 2,
"name": "umbrella",
"isthing": 1
},
{
"id": 3,
"name": "tree-merged",
"isthing": 0
},
{
"id": 4,
"name": "bird",
"isthing": 1
},
{
"id": 5,
"name": "sky",
"isthing": 0
},
{
"id": 6,
"name": "cat",
"isthing": 1
}
]
}
{
"info": {
"description": "Test COCO-format dataset",
"url": "https://github.com/tensorflow/models/tree/master/research/deeplab",
"version": "1.0",
"year": 2019
},
"images": [
{
"id": 1,
"file_name": "bird.jpg",
"height": 159,
"width": 240,
"flickr_url": "https://www.flickr.com/photos/chivinskia/40619099560"
},
{
"id": 2,
"file_name": "cat.jpg",
"height": 330,
"width": 317,
"flickr_url": "https://www.flickr.com/photos/magdalena_b/4995858743"
},
{
"id": 3,
"file_name": "team.jpg",
"height": 231,
"width": 345
},
{
"id": 4,
"file_name": "congress.jpg",
"height": 267,
"width": 525
}
],
"annotations": [
{
"image_id": 1,
"file_name": "bird.png",
"segments_info": [
{
"id": 55551,
"area": 3039,
"category_id": 4,
"iscrowd": 0
},
{
"id": 16216831,
"area": 33659,
"category_id": 5,
"iscrowd": 0
},
{
"id": 16760832,
"area": 1237,
"category_id": 3,
"iscrowd": 0
}
]
},
{
"image_id": 2,
"file_name": "cat.png",
"segments_info": [
{
"id": 36493,
"area": 26910,
"category_id": 6,
"iscrowd": 0
}
]
},
{
"image_id": 3,
"file_name": "team.png",
"segments_info": [
{
"id": 0,
"area": 22164,
"category_id": 1,
"iscrowd": 0
},
{
"id": 129,
"area": 3418,
"category_id": 1,
"iscrowd": 0
},
{
"id": 255,
"area": 12827,
"category_id": 1,
"iscrowd": 0
},
{
"id": 740608,
"area": 8606,
"category_id": 1,
"iscrowd": 0
},
{
"id": 2555695,
"area": 7636,
"category_id": 1,
"iscrowd": 0
},
{
"id": 2883541,
"area": 6844,
"category_id": 1,
"iscrowd": 0
},
{
"id": 14408667,
"area": 4766,
"category_id": 1,
"iscrowd": 0
},
{
"id": 16711820,
"area": 4767,
"category_id": 1,
"iscrowd": 0
},
{
"id": 16768768,
"area": 8667,
"category_id": 1,
"iscrowd": 0
}
]
},
{
"image_id": 4,
"file_name": "congress.png",
"segments_info": [
{
"id": 255,
"area": 2599,
"category_id": 1,
"iscrowd": 0
},
{
"id": 37375,
"area": 386,
"category_id": 1,
"iscrowd": 0
},
{
"id": 62207,
"area": 384,
"category_id": 1,
"iscrowd": 0
},
{
"id": 5177088,
"area": 260,
"category_id": 1,
"iscrowd": 0
},
{
"id": 16711691,
"area": 1011,
"category_id": 1,
"iscrowd": 0
},
{
"id": 16774912,
"area": 803,
"category_id": 1,
"iscrowd": 0
}
]
}
],
"categories": [
{
"id": 1,
"name": "person",
"isthing": 1
},
{
"id": 2,
"name": "umbrella",
"isthing": 1
},
{
"id": 3,
"name": "tree-merged",
"isthing": 0
},
{
"id": 4,
"name": "bird",
"isthing": 1
},
{
"id": 5,
"name": "sky",
"isthing": 0
},
{
"id": 6,
"name": "cat",
"isthing": 1
}
]
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment