register.py 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. # copyright (c) 2024 PaddlePaddle Authors. All Rights Reserve.
  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. import os
  15. import os.path as osp
  16. from pathlib import Path
  17. from ...base.register import register_model_info, register_suite_info
  18. from .model import InstanceSegModel
  19. from .config import InstanceSegConfig
  20. from .runner import InstanceSegRunner
  21. REPO_ROOT_PATH = os.environ.get("PADDLE_PDX_PADDLEDETECTION_PATH")
  22. PDX_CONFIG_DIR = osp.abspath(osp.join(osp.dirname(__file__), "..", "configs"))
  23. HPI_CONFIG_DIR = Path(__file__).parent.parent.parent.parent / "utils" / "hpi_configs"
  24. register_suite_info(
  25. {
  26. "suite_name": "InstanceSeg",
  27. "model": InstanceSegModel,
  28. "runner": InstanceSegRunner,
  29. "config": InstanceSegConfig,
  30. "runner_root_path": REPO_ROOT_PATH,
  31. }
  32. )
  33. ################ Models Using Universal Config ################
  34. register_model_info(
  35. {
  36. "model_name": "Mask-RT-DETR-S",
  37. "suite": "InstanceSeg",
  38. "config_path": osp.join(PDX_CONFIG_DIR, "Mask-RT-DETR-S.yaml"),
  39. "supported_apis": ["train", "evaluate", "predict", "export"],
  40. "supported_dataset_types": ["COCOInstSegDataset"],
  41. "supported_train_opts": {
  42. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  43. "dy2st": False,
  44. "amp": ["OFF"],
  45. },
  46. }
  47. )
  48. register_model_info(
  49. {
  50. "model_name": "Mask-RT-DETR-M",
  51. "suite": "InstanceSeg",
  52. "config_path": osp.join(PDX_CONFIG_DIR, "Mask-RT-DETR-M.yaml"),
  53. "supported_apis": ["train", "evaluate", "predict", "export"],
  54. "supported_dataset_types": ["COCOInstSegDataset"],
  55. "supported_train_opts": {
  56. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  57. "dy2st": False,
  58. "amp": ["OFF"],
  59. },
  60. }
  61. )
  62. register_model_info(
  63. {
  64. "model_name": "Mask-RT-DETR-L",
  65. "suite": "InstanceSeg",
  66. "config_path": osp.join(PDX_CONFIG_DIR, "Mask-RT-DETR-L.yaml"),
  67. "supported_apis": ["train", "evaluate", "predict", "export"],
  68. "supported_dataset_types": ["COCOInstSegDataset"],
  69. "supported_train_opts": {
  70. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  71. "dy2st": False,
  72. "amp": ["OFF"],
  73. },
  74. "hpi_config_path": HPI_CONFIG_DIR / "Mask-RT-DETR-L.yaml",
  75. }
  76. )
  77. register_model_info(
  78. {
  79. "model_name": "Mask-RT-DETR-X",
  80. "suite": "InstanceSeg",
  81. "config_path": osp.join(PDX_CONFIG_DIR, "Mask-RT-DETR-X.yaml"),
  82. "supported_apis": ["train", "evaluate", "predict", "export"],
  83. "supported_dataset_types": ["COCOInstSegDataset"],
  84. "supported_train_opts": {
  85. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  86. "dy2st": False,
  87. "amp": ["OFF"],
  88. },
  89. }
  90. )
  91. register_model_info(
  92. {
  93. "model_name": "Mask-RT-DETR-H",
  94. "suite": "InstanceSeg",
  95. "config_path": osp.join(PDX_CONFIG_DIR, "Mask-RT-DETR-H.yaml"),
  96. "supported_apis": ["train", "evaluate", "predict", "export"],
  97. "supported_dataset_types": ["COCOInstSegDataset"],
  98. "supported_train_opts": {
  99. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  100. "dy2st": False,
  101. "amp": ["OFF"],
  102. },
  103. "hpi_config_path": HPI_CONFIG_DIR / "Mask-RT-DETR-H.yaml",
  104. }
  105. )
  106. register_model_info(
  107. {
  108. "model_name": "SOLOv2",
  109. "suite": "InstanceSeg",
  110. "config_path": osp.join(PDX_CONFIG_DIR, "SOLOv2.yaml"),
  111. "supported_apis": ["train", "evaluate", "predict", "export"],
  112. "supported_dataset_types": ["COCOInstSegDataset"],
  113. "supported_train_opts": {
  114. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  115. "dy2st": False,
  116. "amp": ["OFF"],
  117. },
  118. }
  119. )
  120. register_model_info(
  121. {
  122. "model_name": "MaskRCNN-ResNet50",
  123. "suite": "InstanceSeg",
  124. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet50.yaml"),
  125. "supported_apis": ["train", "evaluate", "predict", "export"],
  126. "supported_dataset_types": ["COCOInstSegDataset"],
  127. "supported_train_opts": {
  128. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  129. "dy2st": False,
  130. "amp": ["OFF"],
  131. },
  132. }
  133. )
  134. register_model_info(
  135. {
  136. "model_name": "MaskRCNN-ResNet50-FPN",
  137. "suite": "InstanceSeg",
  138. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet50-FPN.yaml"),
  139. "supported_apis": ["train", "evaluate", "predict", "export"],
  140. "supported_dataset_types": ["COCOInstSegDataset"],
  141. "supported_train_opts": {
  142. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  143. "dy2st": False,
  144. "amp": ["OFF"],
  145. },
  146. }
  147. )
  148. register_model_info(
  149. {
  150. "model_name": "MaskRCNN-ResNet50-vd-FPN",
  151. "suite": "InstanceSeg",
  152. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet50-vd-FPN.yaml"),
  153. "supported_apis": ["train", "evaluate", "predict", "export"],
  154. "supported_dataset_types": ["COCOInstSegDataset"],
  155. "supported_train_opts": {
  156. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  157. "dy2st": False,
  158. "amp": ["OFF"],
  159. },
  160. }
  161. )
  162. register_model_info(
  163. {
  164. "model_name": "MaskRCNN-ResNet50-vd-SSLDv2-FPN",
  165. "suite": "InstanceSeg",
  166. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet50-vd-SSLDv2-FPN.yaml"),
  167. "supported_apis": ["train", "evaluate", "predict", "export"],
  168. "supported_dataset_types": ["COCOInstSegDataset"],
  169. "supported_train_opts": {
  170. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  171. "dy2st": False,
  172. "amp": ["OFF"],
  173. },
  174. }
  175. )
  176. register_model_info(
  177. {
  178. "model_name": "MaskRCNN-ResNet101-FPN",
  179. "suite": "InstanceSeg",
  180. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet101-FPN.yaml"),
  181. "supported_apis": ["train", "evaluate", "predict", "export"],
  182. "supported_dataset_types": ["COCOInstSegDataset"],
  183. "supported_train_opts": {
  184. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  185. "dy2st": False,
  186. "amp": ["OFF"],
  187. },
  188. }
  189. )
  190. register_model_info(
  191. {
  192. "model_name": "MaskRCNN-ResNet101-vd-FPN",
  193. "suite": "InstanceSeg",
  194. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNet101-vd-FPN.yaml"),
  195. "supported_apis": ["train", "evaluate", "predict", "export"],
  196. "supported_dataset_types": ["COCOInstSegDataset"],
  197. "supported_train_opts": {
  198. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  199. "dy2st": False,
  200. "amp": ["OFF"],
  201. },
  202. }
  203. )
  204. register_model_info(
  205. {
  206. "model_name": "MaskRCNN-ResNeXt101-vd-FPN",
  207. "suite": "InstanceSeg",
  208. "config_path": osp.join(PDX_CONFIG_DIR, "MaskRCNN-ResNeXt101-vd-FPN.yaml"),
  209. "supported_apis": ["train", "evaluate", "predict", "export"],
  210. "supported_dataset_types": ["COCOInstSegDataset"],
  211. "supported_train_opts": {
  212. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  213. "dy2st": False,
  214. "amp": ["OFF"],
  215. },
  216. }
  217. )
  218. register_model_info(
  219. {
  220. "model_name": "Cascade-MaskRCNN-ResNet50-FPN",
  221. "suite": "InstanceSeg",
  222. "config_path": osp.join(PDX_CONFIG_DIR, "Cascade-MaskRCNN-ResNet50-FPN.yaml"),
  223. "supported_apis": ["train", "evaluate", "predict", "export"],
  224. "supported_dataset_types": ["COCOInstSegDataset"],
  225. "supported_train_opts": {
  226. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  227. "dy2st": False,
  228. "amp": ["OFF"],
  229. },
  230. }
  231. )
  232. register_model_info(
  233. {
  234. "model_name": "Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN",
  235. "suite": "InstanceSeg",
  236. "config_path": osp.join(
  237. PDX_CONFIG_DIR, "Cascade-MaskRCNN-ResNet50-vd-SSLDv2-FPN.yaml"
  238. ),
  239. "supported_apis": ["train", "evaluate", "predict", "export"],
  240. "supported_dataset_types": ["COCOInstSegDataset"],
  241. "supported_train_opts": {
  242. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  243. "dy2st": False,
  244. "amp": ["OFF"],
  245. },
  246. }
  247. )
  248. register_model_info(
  249. {
  250. "model_name": "PP-YOLOE_seg-S",
  251. "suite": "InstanceSeg",
  252. "config_path": osp.join(PDX_CONFIG_DIR, "PP-YOLOE_seg-S.yaml"),
  253. "supported_apis": ["train", "evaluate", "predict", "export"],
  254. "supported_dataset_types": ["COCOInstSegDataset"],
  255. "supported_train_opts": {
  256. "device": ["cpu", "gpu_nxcx", "xpu", "npu", "mlu"],
  257. "dy2st": False,
  258. "amp": ["OFF"],
  259. },
  260. }
  261. )