2 Copyright (c) 2019 Intel Corporation
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
18 from ..utils import remove_difficult
19 from .base_representation import BaseRepresentation
22 class TextDetectionRepresentation(BaseRepresentation):
23 def __init__(self, identifier='', points=None):
24 super().__init__(identifier)
25 self.points = points or []
27 def remove(self, indexes):
28 self.points = np.delete(self.points, indexes, axis=0)
29 difficult = self.metadata.get('difficult_boxes')
32 self.metadata['difficult_boxes'] = remove_difficult(difficult, indexes)
35 class TextDetectionAnnotation(TextDetectionRepresentation):
36 def __init__(self, identifier='', points=None, description=''):
37 super().__init__(identifier, points)
38 self.description = description
40 def remove(self, indexes):
41 super().remove(indexes)
42 self.description = np.delete(self.description, indexes)
45 class TextDetectionPrediction(TextDetectionRepresentation):