object.py 3.13 KB
Newer Older
1
"""Pascal VOC object detection dataset."""
2
3
from __future__ import absolute_import, division

4
import json
5
6
import logging
import os
7
import pickle
8
9
10
import warnings
from collections import Counter

11
import mxnet as mx
12
import numpy as np
13
from gluoncv.data import COCODetection
14

15
16

class VGObject(COCODetection):
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
    CLASSES = [
        "airplane",
        "animal",
        "arm",
        "bag",
        "banana",
        "basket",
        "beach",
        "bear",
        "bed",
        "bench",
        "bike",
        "bird",
        "board",
        "boat",
        "book",
        "boot",
        "bottle",
        "bowl",
        "box",
        "boy",
        "branch",
        "building",
        "bus",
        "cabinet",
        "cap",
        "car",
        "cat",
        "chair",
        "child",
        "clock",
        "coat",
        "counter",
        "cow",
        "cup",
        "curtain",
        "desk",
        "dog",
        "door",
        "drawer",
        "ear",
        "elephant",
        "engine",
        "eye",
        "face",
        "fence",
        "finger",
        "flag",
        "flower",
        "food",
        "fork",
        "fruit",
        "giraffe",
        "girl",
        "glass",
        "glove",
        "guy",
        "hair",
        "hand",
        "handle",
        "hat",
        "head",
        "helmet",
        "hill",
        "horse",
        "house",
        "jacket",
        "jean",
        "kid",
        "kite",
        "lady",
        "lamp",
        "laptop",
        "leaf",
        "leg",
        "letter",
        "light",
        "logo",
        "man",
        "men",
        "motorcycle",
        "mountain",
        "mouth",
        "neck",
        "nose",
        "number",
        "orange",
        "pant",
        "paper",
        "paw",
        "people",
        "person",
        "phone",
        "pillow",
        "pizza",
        "plane",
        "plant",
        "plate",
        "player",
        "pole",
        "post",
        "pot",
        "racket",
        "railing",
        "rock",
        "roof",
        "room",
        "screen",
        "seat",
        "sheep",
        "shelf",
        "shirt",
        "shoe",
        "short",
        "sidewalk",
        "sign",
        "sink",
        "skateboard",
        "ski",
        "skier",
        "sneaker",
        "snow",
        "sock",
        "stand",
        "street",
        "surfboard",
        "table",
        "tail",
        "tie",
        "tile",
        "tire",
        "toilet",
        "towel",
        "tower",
        "track",
        "train",
        "tree",
        "truck",
        "trunk",
        "umbrella",
        "vase",
        "vegetable",
        "vehicle",
        "wave",
        "wheel",
        "window",
        "windshield",
        "wing",
        "wire",
        "woman",
        "zebra",
    ]

170
171
    def __init__(self, **kwargs):
        super(VGObject, self).__init__(**kwargs)
172

173
174
    @property
    def annotation_dir(self):
175
        return ""
176
177

    def _parse_image_path(self, entry):
178
179
        dirname = "VG_100K"
        filename = entry["file_name"]
180
181
        abs_path = os.path.join(self._root, dirname, filename)
        return abs_path