__init__.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from ...object_detection.dataset_checker import COCODatasetChecker
  15. from ..model_list import MODELS
  16. from .dataset_src import check
  17. class KeypointDatasetChecker(COCODatasetChecker):
  18. """Dataset Checker for Object Detection Model"""
  19. entities = MODELS
  20. sample_num = 10
  21. def get_dataset_type(self) -> str:
  22. """return the dataset type
  23. Returns:
  24. str: dataset type
  25. """
  26. return "KeypointTopDownCocoDetDataset"
  27. def check_dataset(self, dataset_dir: str, sample_num: int = sample_num) -> dict:
  28. """check if the dataset meets the specifications and get dataset summary
  29. Args:
  30. dataset_dir (str): the root directory of dataset.
  31. sample_num (int): the number to be sampled.
  32. Returns:
  33. dict: dataset summary.
  34. """
  35. return check(dataset_dir, self.output)
  36. def convert_dataset(self, src_dataset_dir: str) -> str:
  37. """convert the dataset from other type to specified type
  38. Args:
  39. src_dataset_dir (str): the root directory of dataset.
  40. Returns:
  41. str: the root directory of converted dataset.
  42. """
  43. dst_dataset_dir = src_dataset_dir
  44. return dst_dataset_dir