register.py 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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 ...base.register import register_model_info, register_suite_info
  17. from .model import DetModel
  18. from .config import DetConfig
  19. from .runner import DetRunner
  20. REPO_ROOT_PATH = os.environ.get('PADDLE_PDX_PADDLEDETECTION_PATH')
  21. PDX_CONFIG_DIR = osp.abspath(osp.join(osp.dirname(__file__), '..', 'configs'))
  22. register_suite_info({
  23. 'suite_name': 'Det',
  24. 'model': DetModel,
  25. 'runner': DetRunner,
  26. 'config': DetConfig,
  27. 'runner_root_path': REPO_ROOT_PATH
  28. })
  29. ################ Models Using Universal Config ################
  30. register_model_info({
  31. 'model_name': 'PicoDet-S',
  32. 'suite': 'Det',
  33. 'config_path': osp.join(PDX_CONFIG_DIR, 'PicoDet-S.yaml'),
  34. 'auto_compression_config_path':
  35. osp.join(PDX_CONFIG_DIR, 'slim', 'picodet_s_lcnet_qat.yml'),
  36. 'supported_apis':
  37. ['train', 'evaluate', 'predict', 'export', 'compression'],
  38. 'supported_dataset_types': ['COCODetDataset'],
  39. })
  40. register_model_info({
  41. 'model_name': 'PicoDet-L',
  42. 'suite': 'Det',
  43. 'config_path': osp.join(PDX_CONFIG_DIR, 'PicoDet-L.yaml'),
  44. 'auto_compression_config_path':
  45. osp.join(PDX_CONFIG_DIR, 'slim', 'picodet_l_lcnet_qat.yml'),
  46. 'supported_apis':
  47. ['train', 'evaluate', 'predict', 'export', 'compression'],
  48. 'supported_dataset_types': ['COCODetDataset'],
  49. })
  50. register_model_info({
  51. 'model_name': 'PP-YOLOE_plus-S',
  52. 'suite': 'Det',
  53. 'config_path': osp.join(PDX_CONFIG_DIR, 'PP-YOLOE_plus-S.yaml'),
  54. 'auto_compression_config_path':
  55. osp.join(PDX_CONFIG_DIR, 'slim', 'ppyoloe_plus_crn_s_qat.yml'),
  56. 'supported_apis':
  57. ['train', 'evaluate', 'predict', 'export', 'compression'],
  58. 'supported_dataset_types': ['COCODetDataset'],
  59. 'supported_train_opts': {
  60. 'device': ['cpu', 'gpu_nxcx'],
  61. 'dy2st': False,
  62. 'amp': ['O1', 'O2']
  63. },
  64. })
  65. register_model_info({
  66. 'model_name': 'PP-YOLOE_plus-M',
  67. 'suite': 'Det',
  68. 'config_path': osp.join(PDX_CONFIG_DIR, 'PP-YOLOE_plus-M.yaml'),
  69. 'auto_compression_config_path':
  70. osp.join(PDX_CONFIG_DIR, 'slim', 'ppyoloe_plus_crn_l_qat.yml'),
  71. 'supported_apis':
  72. ['train', 'evaluate', 'predict', 'export', 'compression'],
  73. 'supported_dataset_types': ['COCODetDataset'],
  74. 'supported_train_opts': {
  75. 'device': ['cpu', 'gpu_nxcx'],
  76. 'dy2st': False,
  77. 'amp': ['O1', 'O2']
  78. },
  79. })
  80. register_model_info({
  81. 'model_name': 'PP-YOLOE_plus-L',
  82. 'suite': 'Det',
  83. 'config_path': osp.join(PDX_CONFIG_DIR, 'PP-YOLOE_plus-L.yaml'),
  84. 'supported_apis': ['train', 'evaluate', 'predict', 'export'],
  85. 'supported_dataset_types': ['COCODetDataset'],
  86. 'supported_train_opts': {
  87. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  88. 'dy2st': False,
  89. 'amp': ['O1', 'O2']
  90. },
  91. })
  92. register_model_info({
  93. 'model_name': 'PP-YOLOE_plus-X',
  94. 'suite': 'Det',
  95. 'config_path': osp.join(PDX_CONFIG_DIR, 'PP-YOLOE_plus-X.yaml'),
  96. 'supported_apis': ['train', 'evaluate', 'predict', 'export'],
  97. 'supported_dataset_types': ['COCODetDataset'],
  98. 'supported_train_opts': {
  99. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  100. 'dy2st': False,
  101. 'amp': ['O1', 'O2']
  102. },
  103. })
  104. register_model_info({
  105. 'model_name': 'RT-DETR-L',
  106. 'suite': 'Det',
  107. 'config_path': osp.join(PDX_CONFIG_DIR, 'RT-DETR-L.yaml'),
  108. 'supported_apis': ['train', 'evaluate', 'predict', 'export'],
  109. 'supported_dataset_types': ['COCODetDataset'],
  110. 'supported_train_opts': {
  111. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  112. 'dy2st': False,
  113. 'amp': ["OFF"]
  114. },
  115. })
  116. register_model_info({
  117. 'model_name': 'RT-DETR-H',
  118. 'suite': 'Det',
  119. 'config_path': osp.join(PDX_CONFIG_DIR, 'RT-DETR-H.yaml'),
  120. 'supported_apis': ['train', 'evaluate', 'predict', 'export'],
  121. 'supported_dataset_types': ['COCODetDataset'],
  122. 'supported_train_opts': {
  123. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  124. 'dy2st': False,
  125. 'amp': ["OFF"]
  126. },
  127. })
  128. register_model_info({
  129. 'model_name': 'RT-DETR-X',
  130. 'suite': 'Det',
  131. 'config_path': osp.join(PDX_CONFIG_DIR, 'RT-DETR-X.yaml'),
  132. 'supported_apis': ['train', 'evaluate', 'predict', 'export'],
  133. 'supported_dataset_types': ['COCODetDataset'],
  134. 'supported_train_opts': {
  135. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  136. 'dy2st': False,
  137. 'amp': ["OFF"]
  138. },
  139. })
  140. register_model_info({
  141. 'model_name': 'RT-DETR-R18',
  142. 'suite': 'Det',
  143. 'config_path': osp.join(PDX_CONFIG_DIR, 'RT-DETR-R18.yaml'),
  144. 'supported_apis': ['train', 'evaluate', 'predict', 'export'],
  145. 'supported_dataset_types': ['COCODetDataset'],
  146. 'supported_train_opts': {
  147. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  148. 'dy2st': False,
  149. 'amp': ["OFF"]
  150. },
  151. })
  152. register_model_info({
  153. 'model_name': 'RT-DETR-R50',
  154. 'suite': 'Det',
  155. 'config_path': osp.join(PDX_CONFIG_DIR, 'RT-DETR-R50.yaml'),
  156. 'supported_apis': ['train', 'evaluate', 'predict', 'export'],
  157. 'supported_dataset_types': ['COCODetDataset'],
  158. 'supported_train_opts': {
  159. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  160. 'dy2st': False,
  161. 'amp': ["OFF"]
  162. },
  163. })
  164. register_model_info({
  165. 'model_name': 'PicoDet_layout_1x',
  166. 'suite': 'Det',
  167. 'config_path': osp.join(PDX_CONFIG_DIR, 'PicoDet_layout_1x.yaml'),
  168. 'supported_apis': ['train', 'evaluate', 'predict', 'export'],
  169. 'supported_dataset_types': ['COCODetDataset'],
  170. 'supported_train_opts': {
  171. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  172. 'dy2st': False,
  173. 'amp': ['OFF']
  174. },
  175. })
  176. register_model_info({
  177. 'model_name': 'YOLOv3-DarkNet53',
  178. 'suite': 'Det',
  179. 'config_path': osp.join(PDX_CONFIG_DIR, 'YOLOv3-DarkNet53.yaml'),
  180. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer'],
  181. 'supported_dataset_types': ['COCODetDataset'],
  182. 'supported_train_opts': {
  183. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  184. 'dy2st': False,
  185. 'amp': ['OFF']
  186. },
  187. })
  188. register_model_info({
  189. 'model_name': 'YOLOv3-MobileNetV3',
  190. 'suite': 'Det',
  191. 'config_path': osp.join(PDX_CONFIG_DIR, 'YOLOv3-MobileNetV3.yaml'),
  192. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer'],
  193. 'supported_dataset_types': ['COCODetDataset'],
  194. 'supported_train_opts': {
  195. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  196. 'dy2st': False,
  197. 'amp': ['OFF']
  198. },
  199. })
  200. register_model_info({
  201. 'model_name': 'YOLOv3-ResNet50_vd_DCN',
  202. 'suite': 'Det',
  203. 'config_path': osp.join(PDX_CONFIG_DIR, 'YOLOv3-ResNet50_vd_DCN.yaml'),
  204. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer'],
  205. 'supported_dataset_types': ['COCODetDataset'],
  206. 'supported_train_opts': {
  207. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  208. 'dy2st': False,
  209. 'amp': ['OFF']
  210. },
  211. })
  212. register_model_info({
  213. 'model_name': 'YOLOX-L',
  214. 'suite': 'Det',
  215. 'config_path': osp.join(PDX_CONFIG_DIR, 'YOLOX-L.yaml'),
  216. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer'],
  217. 'supported_dataset_types': ['COCODetDataset'],
  218. 'supported_train_opts': {
  219. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  220. 'dy2st': False,
  221. 'amp': ['OFF']
  222. },
  223. })
  224. register_model_info({
  225. 'model_name': 'YOLOX-M',
  226. 'suite': 'Det',
  227. 'config_path': osp.join(PDX_CONFIG_DIR, 'YOLOX-M.yaml'),
  228. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer'],
  229. 'supported_dataset_types': ['COCODetDataset'],
  230. 'supported_train_opts': {
  231. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  232. 'dy2st': False,
  233. 'amp': ['OFF']
  234. },
  235. })
  236. register_model_info({
  237. 'model_name': 'YOLOX-N',
  238. 'suite': 'Det',
  239. 'config_path': osp.join(PDX_CONFIG_DIR, 'YOLOX-N.yaml'),
  240. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer'],
  241. 'supported_dataset_types': ['COCODetDataset'],
  242. 'supported_train_opts': {
  243. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  244. 'dy2st': False,
  245. 'amp': ['OFF']
  246. },
  247. })
  248. register_model_info({
  249. 'model_name': 'YOLOX-S',
  250. 'suite': 'Det',
  251. 'config_path': osp.join(PDX_CONFIG_DIR, 'YOLOX-S.yaml'),
  252. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer'],
  253. 'supported_dataset_types': ['COCODetDataset'],
  254. 'supported_train_opts': {
  255. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  256. 'dy2st': False,
  257. 'amp': ['OFF']
  258. },
  259. })
  260. register_model_info({
  261. 'model_name': 'YOLOX-T',
  262. 'suite': 'Det',
  263. 'config_path': osp.join(PDX_CONFIG_DIR, 'YOLOX-T.yaml'),
  264. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer'],
  265. 'supported_dataset_types': ['COCODetDataset'],
  266. 'supported_train_opts': {
  267. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  268. 'dy2st': False,
  269. 'amp': ['OFF']
  270. },
  271. })
  272. register_model_info({
  273. 'model_name': 'YOLOX-X',
  274. 'suite': 'Det',
  275. 'config_path': osp.join(PDX_CONFIG_DIR, 'YOLOX-X.yaml'),
  276. 'supported_apis': ['train', 'evaluate', 'predict', 'export', 'infer'],
  277. 'supported_dataset_types': ['COCODetDataset'],
  278. 'supported_train_opts': {
  279. 'device': ['cpu', 'gpu_nxcx', 'xpu', 'npu', 'mlu'],
  280. 'dy2st': False,
  281. 'amp': ['OFF']
  282. },
  283. })