Showing preview only (4,177K chars total). Download the full file or copy to clipboard to get everything.
Repository: clxia12/RT-DETRv3
Branch: main
Commit: 349e7d99a506
Files: 393
Total size: 3.9 MB
Directory structure:
gitextract_swotw2om/
├── .gitignore
├── LICENSE
├── README.md
├── configs/
│ ├── datasets/
│ │ ├── coco_detection.yml
│ │ ├── coco_instance.yml
│ │ ├── culane.yml
│ │ ├── dota.yml
│ │ ├── dota_ms.yml
│ │ ├── lvis_detection.yml
│ │ ├── mcmot.yml
│ │ ├── mot.yml
│ │ ├── objects365_detection.yml
│ │ ├── roadsign_voc.yml
│ │ ├── sniper_coco_detection.yml
│ │ ├── sniper_visdrone_detection.yml
│ │ ├── spine_coco.yml
│ │ ├── visdrone_detection.yml
│ │ ├── voc.yml
│ │ └── wider_face.yml
│ ├── rtdetrv3/
│ │ ├── _base_/
│ │ │ ├── optimizer_6x.yml
│ │ │ ├── rtdetr_reader.yml
│ │ │ └── rtdetrv3_r50vd.yml
│ │ ├── rtdetrv3_r18vd_6x_coco.yml
│ │ ├── rtdetrv3_r18vd_6x_lvis.yml
│ │ ├── rtdetrv3_r34vd_6x_coco.yml
│ │ ├── rtdetrv3_r50vd_6x_coco.yml
│ │ └── rtdetrv3_r50vd_6x_lvis.yml
│ └── runtime.yml
├── dataset/
│ ├── coco/
│ │ └── download_coco.py
│ ├── dota/
│ │ └── .gitignore
│ ├── mot/
│ │ └── gen_labels_MOT.py
│ ├── roadsign_voc/
│ │ ├── download_roadsign_voc.py
│ │ └── label_list.txt
│ ├── spine_coco/
│ │ └── download_spine_coco.py
│ ├── voc/
│ │ ├── create_list.py
│ │ ├── download_voc.py
│ │ └── label_list.txt
│ └── wider_face/
│ └── download_wider_face.sh
├── ppdet/
│ ├── __init__.py
│ ├── core/
│ │ ├── __init__.py
│ │ ├── config/
│ │ │ ├── __init__.py
│ │ │ ├── schema.py
│ │ │ └── yaml_helpers.py
│ │ └── workspace.py
│ ├── data/
│ │ ├── __init__.py
│ │ ├── crop_utils/
│ │ │ ├── __init__.py
│ │ │ ├── annotation_cropper.py
│ │ │ └── chip_box_utils.py
│ │ ├── culane_utils.py
│ │ ├── reader.py
│ │ ├── shm_utils.py
│ │ ├── source/
│ │ │ ├── __init__.py
│ │ │ ├── category.py
│ │ │ ├── coco.py
│ │ │ ├── culane.py
│ │ │ ├── dataset.py
│ │ │ ├── keypoint_coco.py
│ │ │ ├── lvis.py
│ │ │ ├── mot.py
│ │ │ ├── pose3d_cmb.py
│ │ │ ├── sniper_coco.py
│ │ │ ├── voc.py
│ │ │ └── widerface.py
│ │ ├── transform/
│ │ │ ├── __init__.py
│ │ │ ├── atss_assigner.py
│ │ │ ├── autoaugment_utils.py
│ │ │ ├── batch_operators.py
│ │ │ ├── culane_operators.py
│ │ │ ├── gridmask_utils.py
│ │ │ ├── keypoint_operators.py
│ │ │ ├── keypoints_3d_operators.py
│ │ │ ├── mot_operators.py
│ │ │ ├── op_helper.py
│ │ │ ├── operators.py
│ │ │ └── rotated_operators.py
│ │ └── utils.py
│ ├── engine/
│ │ ├── __init__.py
│ │ ├── callbacks.py
│ │ ├── env.py
│ │ ├── export_utils.py
│ │ ├── naive_sync_bn.py
│ │ ├── tracker.py
│ │ ├── trainer.py
│ │ ├── trainer_cot.py
│ │ └── trainer_ssod.py
│ ├── ext_op/
│ │ ├── README.md
│ │ ├── csrc/
│ │ │ ├── matched_rbox_iou/
│ │ │ │ ├── matched_rbox_iou.cc
│ │ │ │ └── matched_rbox_iou.cu
│ │ │ ├── nms_rotated/
│ │ │ │ ├── nms_rotated.cc
│ │ │ │ └── nms_rotated.cu
│ │ │ └── rbox_iou/
│ │ │ ├── rbox_iou.cc
│ │ │ ├── rbox_iou.cu
│ │ │ └── rbox_iou_utils.h
│ │ ├── setup.py
│ │ └── unittest/
│ │ ├── test_matched_rbox_iou.py
│ │ └── test_rbox_iou.py
│ ├── metrics/
│ │ ├── __init__.py
│ │ ├── coco_utils.py
│ │ ├── culane_metrics.py
│ │ ├── fast_cocoeval/
│ │ │ ├── README.md
│ │ │ ├── __init__.py
│ │ │ ├── ext/
│ │ │ │ ├── cocoeval.cc
│ │ │ │ ├── cocoeval.h
│ │ │ │ └── setup.py
│ │ │ └── fast_cocoeval.py
│ │ ├── json_results.py
│ │ ├── keypoint_metrics.py
│ │ ├── lvis_utils.py
│ │ ├── map_utils.py
│ │ ├── mcmot_metrics.py
│ │ ├── metrics.py
│ │ ├── mot_metrics.py
│ │ ├── munkres.py
│ │ ├── pose3d_metrics.py
│ │ └── widerface_utils.py
│ ├── model_zoo/
│ │ ├── .gitignore
│ │ ├── __init__.py
│ │ ├── model_zoo.py
│ │ └── tests/
│ │ ├── __init__.py
│ │ ├── test_get_model.py
│ │ └── test_list_model.py
│ ├── modeling/
│ │ ├── __init__.py
│ │ ├── architectures/
│ │ │ ├── __init__.py
│ │ │ ├── blazeface.py
│ │ │ ├── bytetrack.py
│ │ │ ├── cascade_rcnn.py
│ │ │ ├── centernet.py
│ │ │ ├── centertrack.py
│ │ │ ├── clrnet.py
│ │ │ ├── deepsort.py
│ │ │ ├── detr.py
│ │ │ ├── detr_ssod.py
│ │ │ ├── fairmot.py
│ │ │ ├── faster_rcnn.py
│ │ │ ├── fcos.py
│ │ │ ├── gfl.py
│ │ │ ├── jde.py
│ │ │ ├── keypoint_hrhrnet.py
│ │ │ ├── keypoint_hrnet.py
│ │ │ ├── keypoint_petr.py
│ │ │ ├── keypoint_vitpose.py
│ │ │ ├── mask_rcnn.py
│ │ │ ├── meta_arch.py
│ │ │ ├── multi_stream_detector.py
│ │ │ ├── picodet.py
│ │ │ ├── pose3d_metro.py
│ │ │ ├── ppyoloe.py
│ │ │ ├── queryinst.py
│ │ │ ├── retinanet.py
│ │ │ ├── rtdetrv3.py
│ │ │ ├── s2anet.py
│ │ │ ├── solov2.py
│ │ │ ├── sparse_rcnn.py
│ │ │ ├── ssd.py
│ │ │ ├── tood.py
│ │ │ ├── ttfnet.py
│ │ │ ├── yolo.py
│ │ │ ├── yolof.py
│ │ │ └── yolox.py
│ │ ├── assigners/
│ │ │ ├── __init__.py
│ │ │ ├── atss_assigner.py
│ │ │ ├── clrnet_assigner.py
│ │ │ ├── fcosr_assigner.py
│ │ │ ├── hungarian_assigner.py
│ │ │ ├── max_iou_assigner.py
│ │ │ ├── pose_utils.py
│ │ │ ├── rotated_task_aligned_assigner.py
│ │ │ ├── simota_assigner.py
│ │ │ ├── task_aligned_assigner.py
│ │ │ ├── task_aligned_assigner_cr.py
│ │ │ ├── uniform_assigner.py
│ │ │ └── utils.py
│ │ ├── backbones/
│ │ │ ├── __init__.py
│ │ │ ├── blazenet.py
│ │ │ ├── clrnet_resnet.py
│ │ │ ├── convnext.py
│ │ │ ├── csp_darknet.py
│ │ │ ├── cspresnet.py
│ │ │ ├── darknet.py
│ │ │ ├── dla.py
│ │ │ ├── esnet.py
│ │ │ ├── focalnet.py
│ │ │ ├── ghostnet.py
│ │ │ ├── hardnet.py
│ │ │ ├── hgnet_v2.py
│ │ │ ├── hrnet.py
│ │ │ ├── lcnet.py
│ │ │ ├── lite_hrnet.py
│ │ │ ├── mobilenet_v1.py
│ │ │ ├── mobilenet_v3.py
│ │ │ ├── mobileone.py
│ │ │ ├── name_adapter.py
│ │ │ ├── res2net.py
│ │ │ ├── resnet.py
│ │ │ ├── senet.py
│ │ │ ├── shufflenet_v2.py
│ │ │ ├── swin_transformer.py
│ │ │ ├── trans_encoder.py
│ │ │ ├── transformer_utils.py
│ │ │ ├── vgg.py
│ │ │ ├── vision_transformer.py
│ │ │ ├── vit_mae.py
│ │ │ └── vitpose.py
│ │ ├── bbox_utils.py
│ │ ├── clrnet_utils.py
│ │ ├── cls_utils.py
│ │ ├── heads/
│ │ │ ├── __init__.py
│ │ │ ├── bbox_head.py
│ │ │ ├── cascade_head.py
│ │ │ ├── centernet_head.py
│ │ │ ├── centertrack_head.py
│ │ │ ├── clrnet_head.py
│ │ │ ├── detr_head.py
│ │ │ ├── face_head.py
│ │ │ ├── fcos_head.py
│ │ │ ├── fcosr_head.py
│ │ │ ├── gfl_head.py
│ │ │ ├── keypoint_hrhrnet_head.py
│ │ │ ├── mask_head.py
│ │ │ ├── petr_head.py
│ │ │ ├── pico_head.py
│ │ │ ├── ppyoloe_contrast_head.py
│ │ │ ├── ppyoloe_head.py
│ │ │ ├── ppyoloe_ins_head.py
│ │ │ ├── ppyoloe_r_head.py
│ │ │ ├── retina_head.py
│ │ │ ├── roi_extractor.py
│ │ │ ├── s2anet_head.py
│ │ │ ├── simota_head.py
│ │ │ ├── solov2_head.py
│ │ │ ├── sparse_roi_head.py
│ │ │ ├── sparsercnn_head.py
│ │ │ ├── ssd_head.py
│ │ │ ├── tood_head.py
│ │ │ ├── ttf_head.py
│ │ │ ├── vitpose_head.py
│ │ │ ├── yolo_head.py
│ │ │ └── yolof_head.py
│ │ ├── initializer.py
│ │ ├── keypoint_utils.py
│ │ ├── lane_utils.py
│ │ ├── layers.py
│ │ ├── losses/
│ │ │ ├── __init__.py
│ │ │ ├── clrnet_line_iou_loss.py
│ │ │ ├── clrnet_loss.py
│ │ │ ├── cot_loss.py
│ │ │ ├── ctfocal_loss.py
│ │ │ ├── detr_loss.py
│ │ │ ├── fairmot_loss.py
│ │ │ ├── fcos_loss.py
│ │ │ ├── focal_loss.py
│ │ │ ├── gfocal_loss.py
│ │ │ ├── iou_aware_loss.py
│ │ │ ├── iou_loss.py
│ │ │ ├── jde_loss.py
│ │ │ ├── keypoint_loss.py
│ │ │ ├── pose3d_loss.py
│ │ │ ├── probiou_loss.py
│ │ │ ├── queryinst_loss.py
│ │ │ ├── smooth_l1_loss.py
│ │ │ ├── solov2_loss.py
│ │ │ ├── sparsercnn_loss.py
│ │ │ ├── ssd_loss.py
│ │ │ ├── supcontrast.py
│ │ │ ├── varifocal_loss.py
│ │ │ └── yolo_loss.py
│ │ ├── mot/
│ │ │ ├── __init__.py
│ │ │ ├── matching/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── deepsort_matching.py
│ │ │ │ ├── jde_matching.py
│ │ │ │ └── ocsort_matching.py
│ │ │ ├── motion/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── gmc.py
│ │ │ │ ├── kalman_filter.py
│ │ │ │ └── ocsort_kalman_filter.py
│ │ │ ├── tracker/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── base_jde_tracker.py
│ │ │ │ ├── base_sde_tracker.py
│ │ │ │ ├── botsort_tracker.py
│ │ │ │ ├── center_tracker.py
│ │ │ │ ├── deepsort_tracker.py
│ │ │ │ ├── jde_tracker.py
│ │ │ │ └── ocsort_tracker.py
│ │ │ ├── utils.py
│ │ │ └── visualization.py
│ │ ├── necks/
│ │ │ ├── __init__.py
│ │ │ ├── bifpn.py
│ │ │ ├── blazeface_fpn.py
│ │ │ ├── centernet_fpn.py
│ │ │ ├── channel_mapper.py
│ │ │ ├── clrnet_fpn.py
│ │ │ ├── csp_pan.py
│ │ │ ├── custom_pan.py
│ │ │ ├── dilated_encoder.py
│ │ │ ├── es_pan.py
│ │ │ ├── fpn.py
│ │ │ ├── hrfpn.py
│ │ │ ├── lc_pan.py
│ │ │ ├── ttf_fpn.py
│ │ │ └── yolo_fpn.py
│ │ ├── ops.py
│ │ ├── post_process.py
│ │ ├── proposal_generator/
│ │ │ ├── __init__.py
│ │ │ ├── anchor_generator.py
│ │ │ ├── embedding_rpn_head.py
│ │ │ ├── proposal_generator.py
│ │ │ ├── rpn_head.py
│ │ │ ├── target.py
│ │ │ └── target_layer.py
│ │ ├── rbox_utils.py
│ │ ├── reid/
│ │ │ ├── __init__.py
│ │ │ ├── fairmot_embedding_head.py
│ │ │ ├── jde_embedding_head.py
│ │ │ ├── pplcnet_embedding.py
│ │ │ ├── pyramidal_embedding.py
│ │ │ ├── resnet.py
│ │ │ └── resnet_embedding.py
│ │ ├── shape_spec.py
│ │ ├── ssod/
│ │ │ ├── __init__.py
│ │ │ ├── losses.py
│ │ │ └── utils.py
│ │ ├── tests/
│ │ │ ├── __init__.py
│ │ │ ├── test_architectures.py
│ │ │ ├── test_base.py
│ │ │ ├── test_mstest.py
│ │ │ ├── test_ops.py
│ │ │ └── test_yolov3_loss.py
│ │ └── transformers/
│ │ ├── __init__.py
│ │ ├── deformable_transformer.py
│ │ ├── detr_transformer.py
│ │ ├── dino_transformer.py
│ │ ├── ext_op/
│ │ │ ├── README.md
│ │ │ ├── ms_deformable_attn_op.cc
│ │ │ ├── ms_deformable_attn_op.cu
│ │ │ ├── setup_ms_deformable_attn_op.py
│ │ │ └── test_ms_deformable_attn_op.py
│ │ ├── group_detr_transformer.py
│ │ ├── hybrid_encoder.py
│ │ ├── mask_dino_transformer.py
│ │ ├── mask_rtdetr_transformer.py
│ │ ├── matchers.py
│ │ ├── petr_transformer.py
│ │ ├── position_encoding.py
│ │ ├── rtdetr_transformer.py
│ │ ├── rtdetr_transformerv2.py
│ │ ├── rtdetr_transformerv3.py
│ │ └── utils.py
│ ├── optimizer/
│ │ ├── __init__.py
│ │ ├── adamw.py
│ │ ├── ema.py
│ │ ├── optimizer.py
│ │ └── utils.py
│ ├── slim/
│ │ ├── __init__.py
│ │ ├── distill_loss.py
│ │ ├── distill_model.py
│ │ ├── ofa.py
│ │ ├── prune.py
│ │ ├── quant.py
│ │ └── unstructured_prune.py
│ └── utils/
│ ├── __init__.py
│ ├── cam_utils.py
│ ├── check.py
│ ├── checkpoint.py
│ ├── cli.py
│ ├── colormap.py
│ ├── compact.py
│ ├── download.py
│ ├── fuse_utils.py
│ ├── logger.py
│ ├── profiler.py
│ ├── stats.py
│ ├── visualizer.py
│ └── voc_utils.py
├── requirements.txt
├── scripts/
│ ├── build_wheel.sh
│ ├── eval.sh
│ ├── kill.sh
│ └── train.sh
└── tools/
├── anchor_cluster.py
├── box_distribution.py
├── cam_ppdet.py
├── eval.py
├── eval_mot.py
├── export_model.py
├── gen_semi_coco.py
├── infer.py
├── infer_culane.py
├── infer_mot.py
├── post_quant.py
├── slice_image.py
├── sniper_params_stats.py
├── train.py
└── x2coco.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
English | [简体中文](README_cn.md)
## RT-DETRv3: Real-time End-to-End Object Detection with Hierarchical Dense Positive Supervision
:fire::fire:**[WACV 2025 Oral]** The official implementation of the paper "[RT-DETRv3: Real-time End-to-End Object Detection with Hierarchical Dense Positive Supervision](https://arxiv.org/pdf/2409.08475)". \
[[`arXiv`](https://arxiv.org/pdf/2409.08475)]

## Model Zoo on COCO
| Model | Epoch | Backbone | Input shape | $AP^{val}$ | $AP^{val}_{50}$| Params(M) | FLOPs(G) | T4 TensorRT FP16(FPS) | Weight | Config | Log
|:--------------:|:-----:|:----------:| :-------:|:--------------------------:|:---------------------------:|:---------:|:--------:| :---------------------: |:------------------------------------------------------------------------------------:|:-------------------------------------------:|:---|
| RT-DETRv3-R18 | 6x | ResNet-18 | 640 | 48.1 | 66.2 | 20 | 60 | 217 |[baidu 网盘](https://pan.baidu.com/s/1s7lyT6_fHmczoegQZXdX-w?pwd=54jp) [google drive](https://drive.google.com/file/d/1zIDOjn1qDccC3TBsDlGQHOjVrehd26bk/view?usp=drive_link)| [config](./configs/rtdetrv3/rtdetrv3_r18vd_6x_coco.yml) |
| RT-DETRv3-R34 | 6x | ResNet-34 | 640 | 49.9 | 67.7 | 31 | 92 | 161 | [baidu 网盘](https://pan.baidu.com/s/1VCg6oqNVF9_ZZdmlhUBgSA?pwd=pi32) [google drive](https://drive.google.com/file/d/12-wqAF8i67eqbocaWPK33d4tFkN2wGi2/view?usp=drive_link)| [config](./configs/rtdetrv3/rtdetrv3_r34vd_6x_coco.yml) |
| RT-DETRv3-R50 | 6x | ResNet-50 | 640 | 53.4 | 71.7 | 42 | 136 | 108 | [baidu 网盘](https://pan.baidu.com/s/1DuvrpMIqbU5okoDp16C94g?pwd=wrxy) [google drive](https://drive.google.com/file/d/1wfJE-QgdgqKE0IkiTuoD5HEbZwwZg3sQ/view?usp=drive_link)| [config](./configs/rtdetrv3/rtdetrv3_r50vd_6x_coco.yml) |
| RT-DETRv3-R101 | 6x | ResNet-101 | 640 | 54.6 | 73.1 | 76 | 259 | 74 | | [config](./configs/rtdetrv3/rtdetrv3_r101vd_6x_coco.yml) |
**Notes:**
- RT-DETRv3 uses 4 GPUs for training.
- RT-DETRv3 was trained on COCO train2017 and evaluated on val2017.
## Model Zoo on LVIS
| Model | Epoch | Backbone | Input shape | AP | $AP_{r}$ | $AP_{c}$ | $AP_{f}$ | Weight | Config | Log
|:--------------:|:-----:|:----------:| :-------:|:--------------------------:|:---------------------------:|:---------:| :---------------------: |:------------------------------------------------------------------------------------:|:-------------------------------------------:|:---|
| RT-DETRv3-R18 | 6x | ResNet-18 | 640 | 26.5 | 12.5 | 24.3 | 35.2 | | [config](./configs/rtdetrv3/rtdetrv3_r18vd_6x_lvis.yml) |
| RT-DETRv3-R50 | 6x | ResNet-50 | 640 | 33.9 | 20.2 | 32.5 | 41.5 | | [config](./configs/rtdetrv3/rtdetrv3_r50vd_6x_lvis.yml) |
## Quick start
<details open>
<summary>Install requirements</summary>
<!-- - PaddlePaddle == 2.4.2 -->
```bash
pip install -r requirements.txt
```
</details>
<details>
<summary>Compile (optional)</summary>
```bash
cd ./ppdet/modeling/transformers/ext_op/
python setup_ms_deformable_attn_op.py install
```
See [details](./ppdet/modeling/transformers/ext_op/)
</details>
<details>
<summary>Data preparation</summary>
- Download and extract COCO 2017 train and val images.
```
path/to/coco/
annotations/ # annotation json files
train2017/ # train images
val2017/ # val images
```
- Modify config [`dataset_dir`](configs/datasets/coco_detection.yml)
</details>
<details>
<summary>Training & Evaluation & Testing</summary>
- Training on a Single GPU:
```shell
# training on single-GPU
export CUDA_VISIBLE_DEVICES=0
python tools/train.py -c configs/rtdetrv3/rtdetrv3_r18vd_6x_coco.yml --eval
```
- Training on Multiple GPUs:
```shell
# training on multi-GPU
export CUDA_VISIBLE_DEVICES=0,1,2,3
python -m paddle.distributed.launch --gpus 0,1,2,3 tools/train.py -c configs/rtdetrv3/rtdetrv3_r18vd_6x_coco.yml --fleet --eval
```
- Evaluation:
```shell
python tools/eval.py -c configs/rtdetrv3/rtdetrv3_r18vd_6x_coco.yml \
-o weights=https://bj.bcebos.com/v1/paddledet/models/rtdetrv3_r18vd_6x_coco.pdparams
```
- Inference:
```shell
python tools/infer.py -c configs/rtdetrv3/rtdetrv3_r18vd_6x_coco.yml \
-o weights=https://bj.bcebos.com/v1/paddledet/models/rtdetrv3_r18vd_6x_coco.pdparams \
--infer_img=./demo/000000570688.jpg
```
</details>
## Deploy
<details open>
<summary>1. Export model </summary>
```shell
python tools/export_model.py -c configs/rtdetrv3/rtdetrv3_r18vd_6x_coco.yml \
-o weights=https://bj.bcebos.com/v1/paddledet/models/rtdetrv3_r18vd_6x_coco.pdparams trt=True \
--output_dir=output_inference
```
</details>
<details>
<summary>2. Convert to ONNX </summary>
- Install [Paddle2ONNX](https://github.com/PaddlePaddle/Paddle2ONNX) and ONNX
```shell
pip install onnx==1.13.0
pip install paddle2onnx==1.0.5
```
- Convert:
```shell
paddle2onnx --model_dir=./output_inference/rtdetrv3_r18vd_6x_coco/ \
--model_filename model.pdmodel \
--params_filename model.pdiparams \
--opset_version 16 \
--save_file rtdetrv3_r18vd_6x_coco.onnx
```
</details>
<details>
<summary>3. Convert to TensorRT </summary>
- TensorRT version >= 8.5.1
- Inference can refer to [Bennchmark](../benchmark)
```shell
trtexec --onnx=./rtdetrv3_r18vd_6x_coco.onnx \
--workspace=4096 \
--shapes=image:1x3x640x640 \
--saveEngine=rtdetrv3_r18vd_6x_coco.trt \
--avgRuns=100 \
--fp16
```
-
</details>
## Citation
If you find RT-DETRv3 useful in your research, please consider giving a star ⭐ and citing:
```
@article{wang2024rt,
title={RT-DETRv3: Real-time End-to-End Object Detection with Hierarchical Dense Positive Supervision},
author={Wang, Shuo and Xia, Chunlong and Lv, Feng and Shi, Yifeng},
journal={arXiv preprint arXiv:2409.08475},
year={2024}
}
```
================================================
FILE: configs/datasets/coco_detection.yml
================================================
metric: COCO
num_classes: 80
TrainDataset:
name: COCODataSet
image_dir: train2017
anno_path: annotations/instances_train2017.json
dataset_dir: /root/paddlejob/workspace/env_run/ws/datasets/COCO
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
EvalDataset:
name: COCODataSet
image_dir: val2017
anno_path: annotations/instances_val2017.json
dataset_dir: /root/paddlejob/workspace/env_run/ws/datasets/COCO
allow_empty: true
TestDataset:
name: ImageFolder
anno_path: annotations/instances_val2017.json # also support txt (like VOC's label_list.txt)
dataset_dir: dataset/coco # if set, anno_path will be 'dataset_dir/anno_path'
================================================
FILE: configs/datasets/coco_instance.yml
================================================
metric: COCO
num_classes: 80
TrainDataset:
name: COCODataSet
image_dir: train2017
anno_path: annotations/instances_train2017.json
dataset_dir: dataset/coco
data_fields: ['image', 'gt_bbox', 'gt_class', 'gt_poly', 'is_crowd']
EvalDataset:
name: COCODataSet
image_dir: val2017
anno_path: annotations/instances_val2017.json
dataset_dir: dataset/coco
TestDataset:
name: ImageFolder
anno_path: annotations/instances_val2017.json # also support txt (like VOC's label_list.txt)
dataset_dir: dataset/coco # if set, anno_path will be 'dataset_dir/anno_path'
================================================
FILE: configs/datasets/culane.yml
================================================
metric: CULaneMetric
num_classes: 5 # 4 lanes + background
cut_height: &cut_height 270
dataset_dir: &dataset_dir dataset/culane
TrainDataset:
name: CULaneDataSet
dataset_dir: *dataset_dir
list_path: 'list/train_gt.txt'
split: train
cut_height: *cut_height
EvalDataset:
name: CULaneDataSet
dataset_dir: *dataset_dir
list_path: 'list/test.txt'
split: test
cut_height: *cut_height
TestDataset:
name: CULaneDataSet
dataset_dir: *dataset_dir
list_path: 'list/test.txt'
split: test
cut_height: *cut_height
================================================
FILE: configs/datasets/dota.yml
================================================
metric: RBOX
num_classes: 15
TrainDataset:
!COCODataSet
image_dir: trainval1024/images
anno_path: trainval1024/DOTA_trainval1024.json
dataset_dir: dataset/dota/
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd', 'gt_poly']
EvalDataset:
!COCODataSet
image_dir: trainval1024/images
anno_path: trainval1024/DOTA_trainval1024.json
dataset_dir: dataset/dota/
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd', 'gt_poly']
TestDataset:
!ImageFolder
anno_path: test1024/DOTA_test1024.json
dataset_dir: dataset/dota/
================================================
FILE: configs/datasets/dota_ms.yml
================================================
metric: RBOX
num_classes: 15
TrainDataset:
!COCODataSet
image_dir: trainval1024/images
anno_path: trainval1024/DOTA_trainval1024.json
dataset_dir: dataset/dota_ms/
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd', 'gt_poly']
EvalDataset:
!COCODataSet
image_dir: trainval1024/images
anno_path: trainval1024/DOTA_trainval1024.json
dataset_dir: dataset/dota_ms/
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd', 'gt_poly']
TestDataset:
!ImageFolder
anno_path: test1024/DOTA_test1024.json
dataset_dir: dataset/dota_ms/
================================================
FILE: configs/datasets/lvis_detection.yml
================================================
metric: LVIS
num_classes: 1203
TrainDataset:
name: LVISDataSet
image_dir: .
anno_path: annotations/lvis_v1_train.json
dataset_dir: /root/paddlejob/workspace/env_run/ws/datasets/COCO
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
EvalDataset:
name: LVISDataSet
image_dir: .
anno_path: annotations/lvis_v1_val.json
dataset_dir: /root/paddlejob/workspace/env_run/ws/datasets/COCO
allow_empty: true
TestDataset:
name: ImageFolder
anno_path: annotations/lvis_v1_val.json # also support txt (like VOC's label_list.txt)
dataset_dir: /root/paddlejob/workspace/env_run/ws/datasets/COCO # if set, anno_path will be 'dataset_dir/anno_path'
================================================
FILE: configs/datasets/mcmot.yml
================================================
metric: MCMOT
num_classes: 10
# using VisDrone2019 MOT dataset with 10 classes as default, you can modify it for your needs.
# for MCMOT training
TrainDataset:
!MCMOTDataSet
dataset_dir: dataset/mot
image_lists: ['visdrone_mcmot.train']
data_fields: ['image', 'gt_bbox', 'gt_class', 'gt_ide']
label_list: label_list.txt
# for MCMOT evaluation
# If you want to change the MCMOT evaluation dataset, please modify 'data_root'
EvalMOTDataset:
!MOTImageFolder
dataset_dir: dataset/mot
data_root: visdrone_mcmot/images/val
keep_ori_im: False # set True if save visualization images or video, or used in DeepSORT
# for MCMOT video inference
TestMOTDataset:
!MOTImageFolder
dataset_dir: dataset/mot
keep_ori_im: True # set True if save visualization images or video
================================================
FILE: configs/datasets/mot.yml
================================================
metric: MOT
num_classes: 1
# for MOT training
TrainDataset:
!MOTDataSet
dataset_dir: dataset/mot
image_lists: ['mot17.train', 'caltech.all', 'cuhksysu.train', 'prw.train', 'citypersons.train', 'eth.train']
data_fields: ['image', 'gt_bbox', 'gt_class', 'gt_ide']
# for MOT evaluation
# If you want to change the MOT evaluation dataset, please modify 'data_root'
EvalMOTDataset:
!MOTImageFolder
dataset_dir: dataset/mot
data_root: MOT16/images/train
keep_ori_im: False # set True if save visualization images or video, or used in DeepSORT
# for MOT video inference
TestMOTDataset:
!MOTImageFolder
dataset_dir: dataset/mot
keep_ori_im: True # set True if save visualization images or video
================================================
FILE: configs/datasets/objects365_detection.yml
================================================
metric: COCO
num_classes: 365
TrainDataset:
!COCODataSet
image_dir: train
anno_path: annotations/zhiyuan_objv2_train.json
dataset_dir: dataset/objects365
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
EvalDataset:
!COCODataSet
image_dir: val
anno_path: annotations/zhiyuan_objv2_val.json
dataset_dir: dataset/objects365
allow_empty: true
TestDataset:
!ImageFolder
anno_path: annotations/zhiyuan_objv2_val.json
dataset_dir: dataset/objects365/
================================================
FILE: configs/datasets/roadsign_voc.yml
================================================
metric: VOC
map_type: integral
num_classes: 4
TrainDataset:
name: VOCDataSet
dataset_dir: dataset/roadsign_voc
anno_path: train.txt
label_list: label_list.txt
data_fields: ['image', 'gt_bbox', 'gt_class', 'difficult']
EvalDataset:
name: VOCDataSet
dataset_dir: dataset/roadsign_voc
anno_path: valid.txt
label_list: label_list.txt
data_fields: ['image', 'gt_bbox', 'gt_class', 'difficult']
TestDataset:
name: ImageFolder
anno_path: dataset/roadsign_voc/label_list.txt
================================================
FILE: configs/datasets/sniper_coco_detection.yml
================================================
metric: SNIPERCOCO
num_classes: 80
TrainDataset:
!SniperCOCODataSet
image_dir: train2017
anno_path: annotations/instances_train2017.json
dataset_dir: dataset/coco
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
allow_empty: true
is_trainset: true
image_target_sizes: [2000, 1000]
valid_box_ratio_ranges: [[-1, 0.1],[0.08, -1]]
chip_target_size: 512
chip_target_stride: 200
use_neg_chip: false
max_neg_num_per_im: 8
EvalDataset:
!SniperCOCODataSet
image_dir: val2017
anno_path: annotations/instances_val2017.json
dataset_dir: dataset/coco
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
allow_empty: true
is_trainset: false
image_target_sizes: [2000, 1000]
valid_box_ratio_ranges: [[-1, 0.1], [0.08, -1]]
chip_target_size: 512
chip_target_stride: 200
max_per_img: -1
nms_thresh: 0.5
TestDataset:
!SniperCOCODataSet
image_dir: val2017
dataset_dir: dataset/coco
is_trainset: false
image_target_sizes: [2000, 1000]
valid_box_ratio_ranges: [[-1, 0.1],[0.08, -1]]
chip_target_size: 500
chip_target_stride: 200
max_per_img: -1
nms_thresh: 0.5
================================================
FILE: configs/datasets/sniper_visdrone_detection.yml
================================================
metric: SNIPERCOCO
num_classes: 9
TrainDataset:
!SniperCOCODataSet
image_dir: train
anno_path: annotations/train.json
dataset_dir: dataset/VisDrone2019_coco
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
allow_empty: true
is_trainset: true
image_target_sizes: [8145, 2742]
valid_box_ratio_ranges: [[-1, 0.03142857142857144], [0.02333211853008726, -1]]
chip_target_size: 1536
chip_target_stride: 1184
use_neg_chip: false
max_neg_num_per_im: 8
EvalDataset:
!SniperCOCODataSet
image_dir: val
anno_path: annotations/val.json
dataset_dir: dataset/VisDrone2019_coco
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
allow_empty: true
is_trainset: false
image_target_sizes: [8145, 2742]
valid_box_ratio_ranges: [[-1, 0.03142857142857144], [0.02333211853008726, -1]]
chip_target_size: 1536
chip_target_stride: 1184
max_per_img: -1
nms_thresh: 0.5
TestDataset:
!SniperCOCODataSet
image_dir: val
dataset_dir: dataset/VisDrone2019_coco
is_trainset: false
image_target_sizes: [8145, 2742]
valid_box_ratio_ranges: [[-1, 0.03142857142857144], [0.02333211853008726, -1]]
chip_target_size: 1536
chip_target_stride: 1184
max_per_img: -1
nms_thresh: 0.5
================================================
FILE: configs/datasets/spine_coco.yml
================================================
metric: RBOX
num_classes: 9
TrainDataset:
!COCODataSet
image_dir: images
anno_path: annotations/train.json
dataset_dir: dataset/spine_coco
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd', 'gt_poly']
EvalDataset:
!COCODataSet
image_dir: images
anno_path: annotations/valid.json
dataset_dir: dataset/spine_coco
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd', 'gt_poly']
TestDataset:
!ImageFolder
anno_path: annotations/valid.json
dataset_dir: dataset/spine_coco
================================================
FILE: configs/datasets/visdrone_detection.yml
================================================
metric: COCO
num_classes: 10
TrainDataset:
!COCODataSet
image_dir: VisDrone2019-DET-train
anno_path: train.json
dataset_dir: dataset/visdrone
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
EvalDataset:
!COCODataSet
image_dir: VisDrone2019-DET-val
anno_path: val.json
# image_dir: test_dev
# anno_path: test_dev.json
dataset_dir: dataset/visdrone
TestDataset:
!ImageFolder
anno_path: val.json
dataset_dir: dataset/visdrone
================================================
FILE: configs/datasets/voc.yml
================================================
metric: VOC
map_type: 11point
num_classes: 20
TrainDataset:
name: VOCDataSet
dataset_dir: dataset/voc
anno_path: trainval.txt
label_list: label_list.txt
data_fields: ['image', 'gt_bbox', 'gt_class', 'difficult']
EvalDataset:
name: VOCDataSet
dataset_dir: dataset/voc
anno_path: test.txt
label_list: label_list.txt
data_fields: ['image', 'gt_bbox', 'gt_class', 'difficult']
TestDataset:
name: ImageFolder
anno_path: dataset/voc/label_list.txt
================================================
FILE: configs/datasets/wider_face.yml
================================================
metric: WiderFace
num_classes: 1
TrainDataset:
!WIDERFaceDataSet
dataset_dir: dataset/wider_face
anno_path: wider_face_split/wider_face_train_bbx_gt.txt
image_dir: WIDER_train/images
data_fields: ['image', 'gt_bbox', 'gt_class']
EvalDataset:
!WIDERFaceValDataset
dataset_dir: dataset/wider_face
image_dir: WIDER_val/images
anno_path: wider_face_split/wider_face_val_bbx_gt.txt
gt_mat_path: WIDER_val/ground_truth
data_fields: ['image', 'gt_bbox', 'gt_class', 'ori_gt_bbox']
TestDataset:
!ImageFolder
use_default_label: true
================================================
FILE: configs/rtdetrv3/_base_/optimizer_6x.yml
================================================
epoch: 72
LearningRate:
base_lr: 0.0004
schedulers:
- !PiecewiseDecay
gamma: 1.0
milestones: [100]
use_warmup: true
- !LinearWarmup
start_factor: 0.001
steps: 2000
OptimizerBuilder:
clip_grad_by_norm: 0.1
regularizer: false
optimizer:
type: AdamW
weight_decay: 0.0001
================================================
FILE: configs/rtdetrv3/_base_/rtdetr_reader.yml
================================================
worker_num: 4
TrainReader:
sample_transforms:
- Decode: {}
- RandomDistort: {prob: 0.8}
- RandomExpand: {fill_value: [123.675, 116.28, 103.53]}
- RandomCrop: {prob: 0.8}
- RandomFlip: {}
batch_transforms:
- BatchRandomResize: {target_size: [480, 512, 544, 576, 608, 640, 640, 640, 672, 704, 736, 768, 800], random_size: True, random_interp: True, keep_ratio: False}
- NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none}
- NormalizeBox: {retain_origin_box: true}
- BboxXYXY2XYWH: {}
- Permute: {}
- PadGT: {only_origin_box: true}
batch_size: 16
shuffle: true
drop_last: true
collate_batch: false
use_shared_memory: true
EvalReader:
sample_transforms:
- Decode: {}
- Resize: {target_size: [640, 640], keep_ratio: False, interp: 2}
- NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none}
- Permute: {}
batch_size: 16
shuffle: false
drop_last: false
TestReader:
inputs_def:
image_shape: [3, 640, 640]
sample_transforms:
- Decode: {}
- Resize: {target_size: [640, 640], keep_ratio: False, interp: 2}
- NormalizeImage: {mean: [0., 0., 0.], std: [1., 1., 1.], norm_type: none}
- Permute: {}
batch_size: 1
shuffle: false
drop_last: false
================================================
FILE: configs/rtdetrv3/_base_/rtdetrv3_r50vd.yml
================================================
architecture: RTDETRV3
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_vd_ssld_v2_pretrained.pdparams
norm_type: sync_bn
use_ema: True
ema_decay: 0.9999
ema_decay_type: "exponential"
ema_filter_no_grad: True
hidden_dim: 256
use_focal_loss: True
eval_size: [640, 640]
RTDETRV3:
backbone: ResNet
neck: HybridEncoder
transformer: RTDETRTransformerv3
detr_head: DINOv3Head
aux_o2m_head: PPYOLOEHead
post_process: DETRPostProcess
ResNet:
# index 0 stands for res2
depth: 50
variant: d
norm_type: bn
freeze_at: 0
return_idx: [1, 2, 3]
lr_mult_list: [0.1, 0.1, 0.1, 0.1]
num_stages: 4
freeze_stem_only: True
HybridEncoder:
hidden_dim: 256
use_encoder_idx: [2]
num_encoder_layers: 1
encoder_layer:
name: TransformerLayer
d_model: 256
nhead: 8
dim_feedforward: 1024
dropout: 0.
activation: 'gelu'
expansion: 1.0
RTDETRTransformerv3:
num_queries: 300
position_embed_type: sine
feat_strides: [8, 16, 32]
num_levels: 3
nhead: 8
num_decoder_layers: 6
dim_feedforward: 1024
dropout: 0.0
activation: relu
num_denoising: 100
label_noise_ratio: 0.5
box_noise_scale: 1.0
learnt_init_query: False
num_noises: 0
num_noise_queries: []
num_noise_denoising: 100
learnt_init_query: False
DINOv3Head:
o2m: 4
loss:
name: DINOv3Loss
loss_coeff: {class: 1, bbox: 5, giou: 2}
aux_loss: True
use_vfl: True
matcher:
name: HungarianMatcher
matcher_coeff: {class: 2, bbox: 5, giou: 2}
PPYOLOEHead:
fpn_strides: [8, 16, 32]
grid_cell_scale: 5.0
grid_cell_offset: 0.5
static_assigner_epoch: 30
use_varifocal_loss: True
loss_weight: {class: 1.0, iou: 2.5, dfl: 0.5}
static_assigner:
name: ATSSAssigner
topk: 9
assigner:
name: TaskAlignedAssigner
topk: 13
alpha: 1.0
beta: 6.0
nms:
name: MultiClassNMS
nms_top_k: 1000
keep_top_k: 300
score_threshold: 0.01
nms_threshold: 0.7
DETRPostProcess:
num_top_queries: 300
================================================
FILE: configs/rtdetrv3/rtdetrv3_r18vd_6x_coco.yml
================================================
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'_base_/optimizer_6x.yml',
'_base_/rtdetrv3_r50vd.yml',
'_base_/rtdetr_reader.yml',
]
weights: output/rtdetrv3_r18vd_6x_coco/model_final
find_unused_parameters: True
log_iter: 200
o2m_branch: True
num_queries_o2m: 450
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet18_vd_pretrained.pdparams
RTDETRV3:
backbone: ResNet
neck: HybridEncoder
transformer: RTDETRTransformerv3
detr_head: DINOv3Head
aux_o2m_head: PPYOLOEHead
post_process: DETRPostProcess
ResNet:
depth: 18
variant: d
return_idx: [1, 2, 3]
freeze_at: -1
freeze_norm: false
norm_decay: 0.
HybridEncoder:
hidden_dim: 256
use_encoder_idx: [2]
num_encoder_layers: 1
encoder_layer:
name: TransformerLayer
d_model: 256
nhead: 8
dim_feedforward: 1024
dropout: 0.
activation: 'gelu'
expansion: 0.5
depth_mult: 1.0
RTDETRTransformerv3:
eval_idx: -1
num_decoder_layers: 3
num_noises: 3
num_noise_queries: [300, 300, 300]
num_noise_denoising: 100
learnt_init_query: False
================================================
FILE: configs/rtdetrv3/rtdetrv3_r18vd_6x_lvis.yml
================================================
_BASE_: [
'../datasets/lvis_detection.yml',
'../runtime.yml',
'_base_/optimizer_6x.yml',
'_base_/rtdetrv3_r50vd.yml',
'_base_/rtdetr_reader.yml',
]
weights: output/rtdetrv3vd_r18_6x_lvis/model_final
find_unused_parameters: True
log_iter: 200
o2m_branch: True
num_queries_o2m: 450
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet18_vd_pretrained.pdparams
RTDETRV3:
backbone: ResNet
neck: HybridEncoder
transformer: RTDETRTransformerv3
detr_head: DINOv3Head
aux_o2m_head: PPYOLOEHead
post_process: DETRPostProcess
ResNet:
depth: 18
variant: d
return_idx: [1, 2, 3]
freeze_at: -1
freeze_norm: false
norm_decay: 0.
HybridEncoder:
hidden_dim: 256
use_encoder_idx: [2]
num_encoder_layers: 1
encoder_layer:
name: TransformerLayer
d_model: 256
nhead: 8
dim_feedforward: 1024
dropout: 0.
activation: 'gelu'
expansion: 0.5
depth_mult: 1.0
RTDETRTransformerv3:
eval_idx: -1
num_decoder_layers: 3
num_noises: 2
num_noise_queries: [300, 300]
num_noise_denoising: 100
learnt_init_query: False
================================================
FILE: configs/rtdetrv3/rtdetrv3_r34vd_6x_coco.yml
================================================
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'_base_/optimizer_6x.yml',
'_base_/rtdetrv3_r50vd.yml',
'_base_/rtdetr_reader.yml',
]
weights: output/rtdetrv3_r34vd_6x_coco/model_final
find_unused_parameters: True
log_iter: 200
o2m_branch: True
num_queries_o2m: 450
pretrain_weights: https://bj.bcebos.com/v1/paddledet/models/pretrained/ResNet34_vd_pretrained.pdparams
RTDETRV3:
backbone: ResNet
neck: HybridEncoder
transformer: RTDETRTransformerv3
detr_head: DINOv3Head
aux_o2m_head: PPYOLOEHead
post_process: DETRPostProcess
ResNet:
depth: 34
variant: d
return_idx: [1, 2, 3]
freeze_at: -1
freeze_norm: false
norm_decay: 0.
HybridEncoder:
hidden_dim: 256
use_encoder_idx: [2]
num_encoder_layers: 1
encoder_layer:
name: TransformerLayer
d_model: 256
nhead: 8
dim_feedforward: 1024
dropout: 0.
activation: 'gelu'
expansion: 0.5
depth_mult: 1.0
RTDETRTransformerv3:
eval_idx: -1
num_decoder_layers: 4
num_noises: 3
num_noise_queries: [300, 300, 300]
num_noise_denoising: 100
learnt_init_query: False
================================================
FILE: configs/rtdetrv3/rtdetrv3_r50vd_6x_coco.yml
================================================
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'_base_/optimizer_6x.yml',
'_base_/rtdetrv3_r50vd.yml',
'_base_/rtdetr_reader.yml',
]
weights: output/rtdetrv3_r50vd_6x_coco/model_final
find_unused_parameters: True
log_iter: 200
o2m_branch: True
num_queries_o2m: 450
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_vd_ssld_v2_pretrained.pdparams
RTDETRTransformerv3:
eval_idx: -1
num_decoder_layers: 6
num_noises: 2
num_noise_queries: [300, 300]
num_noise_denoising: 100
learnt_init_query: False
================================================
FILE: configs/rtdetrv3/rtdetrv3_r50vd_6x_lvis.yml
================================================
_BASE_: [
'../datasets/lvis_detection.yml',
'../runtime.yml',
'_base_/optimizer_6x.yml',
'_base_/rtdetrv3_r50vd.yml',
'_base_/rtdetr_reader.yml',
]
weights: output/rtdetrv3_r50vd_6x_lvis/model_final
find_unused_parameters: True
log_iter: 200
snapshot_epoch: 2
o2m_branch: True
num_queries_o2m: 450
pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_vd_ssld_v2_pretrained.pdparams
RTDETRTransformerv3:
eval_idx: -1
num_decoder_layers: 6
num_noises: 1
num_noise_queries: [300]
num_noise_denoising: 100
learnt_init_query: False
================================================
FILE: configs/runtime.yml
================================================
use_gpu: true
use_xpu: false
use_mlu: false
use_npu: false
log_iter: 20
save_dir: output
snapshot_epoch: 1
print_flops: false
print_params: false
# Exporting the model
export:
post_process: True # Whether post-processing is included in the network when export model.
nms: True # Whether NMS is included in the network when export model.
benchmark: False # It is used to testing model performance, if set `True`, post-process and NMS will not be exported.
fuse_conv_bn: False
================================================
FILE: dataset/coco/download_coco.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os.path as osp
import logging
# add python path of PaddleDetection to sys.path
parent_path = osp.abspath(osp.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path:
sys.path.append(parent_path)
from ppdet.utils.download import download_dataset
logging.basicConfig(level=logging.INFO)
download_path = osp.split(osp.realpath(sys.argv[0]))[0]
download_dataset(download_path, 'coco')
================================================
FILE: dataset/dota/.gitignore
================================================
================================================
FILE: dataset/mot/gen_labels_MOT.py
================================================
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os.path as osp
import os
import numpy as np
MOT_data = 'MOT16'
# choose a data in ['MOT15', 'MOT16', 'MOT17', 'MOT20']
# or your custom data (prepare it following the 'docs/tutorials/PrepareMOTDataSet.md')
def mkdirs(d):
if not osp.exists(d):
os.makedirs(d)
seq_root = './{}/images/train'.format(MOT_data)
label_root = './{}/labels_with_ids/train'.format(MOT_data)
mkdirs(label_root)
seqs = [s for s in os.listdir(seq_root)]
tid_curr = 0
tid_last = -1
for seq in seqs:
seq_info = open(osp.join(seq_root, seq, 'seqinfo.ini')).read()
seq_width = int(seq_info[seq_info.find('imWidth=') + 8:seq_info.find(
'\nimHeight')])
seq_height = int(seq_info[seq_info.find('imHeight=') + 9:seq_info.find(
'\nimExt')])
gt_txt = osp.join(seq_root, seq, 'gt', 'gt.txt')
gt = np.loadtxt(gt_txt, dtype=np.float64, delimiter=',')
seq_label_root = osp.join(label_root, seq, 'img1')
mkdirs(seq_label_root)
for fid, tid, x, y, w, h, mark, label, _ in gt:
if mark == 0 or not label == 1:
continue
fid = int(fid)
tid = int(tid)
if not tid == tid_last:
tid_curr += 1
tid_last = tid
x += w / 2
y += h / 2
label_fpath = osp.join(seq_label_root, '{:06d}.txt'.format(fid))
label_str = '0 {:d} {:.6f} {:.6f} {:.6f} {:.6f}\n'.format(
tid_curr, x / seq_width, y / seq_height, w / seq_width,
h / seq_height)
with open(label_fpath, 'a') as f:
f.write(label_str)
================================================
FILE: dataset/roadsign_voc/download_roadsign_voc.py
================================================
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os.path as osp
import logging
# add python path of PaddleDetection to sys.path
parent_path = osp.abspath(osp.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path:
sys.path.append(parent_path)
from ppdet.utils.download import download_dataset
logging.basicConfig(level=logging.INFO)
download_path = osp.split(osp.realpath(sys.argv[0]))[0]
download_dataset(download_path, 'roadsign_voc')
================================================
FILE: dataset/roadsign_voc/label_list.txt
================================================
speedlimit
crosswalk
trafficlight
stop
================================================
FILE: dataset/spine_coco/download_spine_coco.py
================================================
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os.path as osp
import logging
# add python path of PaddleDetection to sys.path
parent_path = osp.abspath(osp.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path:
sys.path.append(parent_path)
from ppdet.utils.download import download_dataset
logging.basicConfig(level=logging.INFO)
download_path = osp.split(osp.realpath(sys.argv[0]))[0]
download_dataset(download_path, 'spine_coco')
================================================
FILE: dataset/voc/create_list.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os.path as osp
import logging
# add python path of PaddleDetection to sys.path
parent_path = osp.abspath(osp.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path:
sys.path.append(parent_path)
from ppdet.utils.download import create_voc_list
logging.basicConfig(level=logging.INFO)
voc_path = osp.split(osp.realpath(sys.argv[0]))[0]
create_voc_list(voc_path)
================================================
FILE: dataset/voc/download_voc.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os.path as osp
import logging
# add python path of PaddleDetection to sys.path
parent_path = osp.abspath(osp.join(__file__, *(['..'] * 3)))
if parent_path not in sys.path:
sys.path.append(parent_path)
from ppdet.utils.download import download_dataset
logging.basicConfig(level=logging.INFO)
download_path = osp.split(osp.realpath(sys.argv[0]))[0]
download_dataset(download_path, 'voc')
================================================
FILE: dataset/voc/label_list.txt
================================================
aeroplane
bicycle
bird
boat
bottle
bus
car
cat
chair
cow
diningtable
dog
horse
motorbike
person
pottedplant
sheep
sofa
train
tvmonitor
================================================
FILE: dataset/wider_face/download_wider_face.sh
================================================
# All rights `PaddleDetection` reserved
# References:
# @inproceedings{yang2016wider,
# Author = {Yang, Shuo and Luo, Ping and Loy, Chen Change and Tang, Xiaoou},
# Booktitle = {IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
# Title = {WIDER FACE: A Face Detection Benchmark},
# Year = {2016}}
DIR="$( cd "$(dirname "$0")" ; pwd -P )"
cd "$DIR"
# Download the data.
echo "Downloading..."
wget https://dataset.bj.bcebos.com/wider_face/WIDER_train.zip
wget https://dataset.bj.bcebos.com/wider_face/WIDER_val.zip
wget https://dataset.bj.bcebos.com/wider_face/wider_face_split.zip
# Extract the data.
echo "Extracting..."
unzip -q WIDER_train.zip
unzip -q WIDER_val.zip
unzip -q wider_face_split.zip
================================================
FILE: ppdet/__init__.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from . import (core, data, engine, modeling, model_zoo, optimizer, metrics,
utils, slim)
try:
from .version import full_version as __version__
from .version import commit as __git_commit__
except ImportError:
import sys
sys.stderr.write("Warning: import ppdet from source directory " \
"without installing, run 'python setup.py install' to " \
"install ppdet firstly\n")
================================================
FILE: ppdet/core/__init__.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from . import config
================================================
FILE: ppdet/core/config/__init__.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
================================================
FILE: ppdet/core/config/schema.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import inspect
import importlib
import re
try:
from docstring_parser import parse as doc_parse
except Exception:
def doc_parse(*args):
pass
try:
from typeguard import check_type
except Exception:
def check_type(*args):
pass
__all__ = ['SchemaValue', 'SchemaDict', 'SharedConfig', 'extract_schema']
class SchemaValue(object):
def __init__(self, name, doc='', type=None):
super(SchemaValue, self).__init__()
self.name = name
self.doc = doc
self.type = type
def set_default(self, value):
self.default = value
def has_default(self):
return hasattr(self, 'default')
class SchemaDict(dict):
def __init__(self, **kwargs):
super(SchemaDict, self).__init__()
self.schema = {}
self.strict = False
self.doc = ""
self.update(kwargs)
def __setitem__(self, key, value):
# XXX also update regular dict to SchemaDict??
if isinstance(value, dict) and key in self and isinstance(self[key],
SchemaDict):
self[key].update(value)
else:
super(SchemaDict, self).__setitem__(key, value)
def __missing__(self, key):
if self.has_default(key):
return self.schema[key].default
elif key in self.schema:
return self.schema[key]
else:
raise KeyError(key)
def copy(self):
newone = SchemaDict()
newone.__dict__.update(self.__dict__)
newone.update(self)
return newone
def set_schema(self, key, value):
assert isinstance(value, SchemaValue)
self.schema[key] = value
def set_strict(self, strict):
self.strict = strict
def has_default(self, key):
return key in self.schema and self.schema[key].has_default()
def is_default(self, key):
if not self.has_default(key):
return False
if hasattr(self[key], '__dict__'):
return True
else:
return key not in self or self[key] == self.schema[key].default
def find_default_keys(self):
return [
k for k in list(self.keys()) + list(self.schema.keys())
if self.is_default(k)
]
def mandatory(self):
return any([k for k in self.schema.keys() if not self.has_default(k)])
def find_missing_keys(self):
missing = [
k for k in self.schema.keys()
if k not in self and not self.has_default(k)
]
placeholders = [k for k in self if self[k] in ('<missing>', '<value>')]
return missing + placeholders
def find_extra_keys(self):
return list(set(self.keys()) - set(self.schema.keys()))
def find_mismatch_keys(self):
mismatch_keys = []
for arg in self.schema.values():
if arg.type is not None:
try:
check_type("{}.{}".format(self.name, arg.name),
self[arg.name], arg.type)
except Exception:
mismatch_keys.append(arg.name)
return mismatch_keys
def validate(self):
missing_keys = self.find_missing_keys()
if missing_keys:
raise ValueError("Missing param for class<{}>: {}".format(
self.name, ", ".join(missing_keys)))
extra_keys = self.find_extra_keys()
if extra_keys and self.strict:
raise ValueError("Extraneous param for class<{}>: {}".format(
self.name, ", ".join(extra_keys)))
mismatch_keys = self.find_mismatch_keys()
if mismatch_keys:
raise TypeError("Wrong param type for class<{}>: {}".format(
self.name, ", ".join(mismatch_keys)))
class SharedConfig(object):
"""
Representation class for `__shared__` annotations, which work as follows:
- if `key` is set for the module in config file, its value will take
precedence
- if `key` is not set for the module but present in the config file, its
value will be used
- otherwise, use the provided `default_value` as fallback
Args:
key: config[key] will be injected
default_value: fallback value
"""
def __init__(self, key, default_value=None):
super(SharedConfig, self).__init__()
self.key = key
self.default_value = default_value
def extract_schema(cls):
"""
Extract schema from a given class
Args:
cls (type): Class from which to extract.
Returns:
schema (SchemaDict): Extracted schema.
"""
ctor = cls.__init__
# python 2 compatibility
if hasattr(inspect, 'getfullargspec'):
argspec = inspect.getfullargspec(ctor)
annotations = argspec.annotations
has_kwargs = argspec.varkw is not None
else:
argspec = inspect.getfullargspec(ctor)
# python 2 type hinting workaround, see pep-3107
# however, since `typeguard` does not support python 2, type checking
# is still python 3 only for now
annotations = getattr(ctor, '__annotations__', {})
has_kwargs = argspec.varkw is not None
names = [arg for arg in argspec.args if arg != 'self']
defaults = argspec.defaults
num_defaults = argspec.defaults is not None and len(argspec.defaults) or 0
num_required = len(names) - num_defaults
docs = cls.__doc__
if docs is None and getattr(cls, '__category__', None) == 'op':
docs = cls.__call__.__doc__
try:
docstring = doc_parse(docs)
except Exception:
docstring = None
if docstring is None:
comments = {}
else:
comments = {}
for p in docstring.params:
match_obj = re.match('^([a-zA-Z_]+[a-zA-Z_0-9]*).*', p.arg_name)
if match_obj is not None:
comments[match_obj.group(1)] = p.description
schema = SchemaDict()
schema.name = cls.__name__
schema.doc = ""
if docs is not None:
start_pos = docs[0] == '\n' and 1 or 0
schema.doc = docs[start_pos:].split("\n")[0].strip()
# XXX handle paddle's weird doc convention
if '**' == schema.doc[:2] and '**' == schema.doc[-2:]:
schema.doc = schema.doc[2:-2].strip()
schema.category = hasattr(cls, '__category__') and getattr(
cls, '__category__') or 'module'
schema.strict = not has_kwargs
schema.pymodule = importlib.import_module(cls.__module__)
schema.inject = getattr(cls, '__inject__', [])
schema.shared = getattr(cls, '__shared__', [])
for idx, name in enumerate(names):
comment = name in comments and comments[name] or name
if name in schema.inject:
type_ = None
else:
type_ = name in annotations and annotations[name] or None
value_schema = SchemaValue(name, comment, type_)
if name in schema.shared:
assert idx >= num_required, "shared config must have default value"
default = defaults[idx - num_required]
value_schema.set_default(SharedConfig(name, default))
elif idx >= num_required:
default = defaults[idx - num_required]
value_schema.set_default(default)
schema.set_schema(name, value_schema)
return schema
================================================
FILE: ppdet/core/config/yaml_helpers.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import importlib
import inspect
import yaml
from .schema import SharedConfig
__all__ = ['serializable', 'Callable']
def represent_dictionary_order(self, dict_data):
return self.represent_mapping('tag:yaml.org,2002:map', dict_data.items())
def setup_orderdict():
from collections import OrderedDict
yaml.add_representer(OrderedDict, represent_dictionary_order)
def _make_python_constructor(cls):
def python_constructor(loader, node):
if isinstance(node, yaml.SequenceNode):
args = loader.construct_sequence(node, deep=True)
return cls(*args)
else:
kwargs = loader.construct_mapping(node, deep=True)
try:
return cls(**kwargs)
except Exception as ex:
print("Error when construct {} instance from yaml config".
format(cls.__name__))
raise ex
return python_constructor
def _make_python_representer(cls):
# python 2 compatibility
if hasattr(inspect, 'getfullargspec'):
argspec = inspect.getfullargspec(cls)
else:
argspec = inspect.getfullargspec(cls.__init__)
argnames = [arg for arg in argspec.args if arg != 'self']
def python_representer(dumper, obj):
if argnames:
data = {name: getattr(obj, name) for name in argnames}
else:
data = obj.__dict__
if '_id' in data:
del data['_id']
return dumper.represent_mapping(u'!{}'.format(cls.__name__), data)
return python_representer
def serializable(cls):
"""
Add loader and dumper for given class, which must be
"trivially serializable"
Args:
cls: class to be serialized
Returns: cls
"""
yaml.add_constructor(u'!{}'.format(cls.__name__),
_make_python_constructor(cls))
yaml.add_representer(cls, _make_python_representer(cls))
return cls
yaml.add_representer(SharedConfig,
lambda d, o: d.represent_data(o.default_value))
@serializable
class Callable(object):
"""
Helper to be used in Yaml for creating arbitrary class objects
Args:
full_type (str): the full module path to target function
"""
def __init__(self, full_type, args=[], kwargs={}):
super(Callable, self).__init__()
self.full_type = full_type
self.args = args
self.kwargs = kwargs
def __call__(self):
if '.' in self.full_type:
idx = self.full_type.rfind('.')
module = importlib.import_module(self.full_type[:idx])
func_name = self.full_type[idx + 1:]
else:
try:
module = importlib.import_module('builtins')
except Exception:
module = importlib.import_module('__builtin__')
func_name = self.full_type
func = getattr(module, func_name)
return func(*self.args, **self.kwargs)
================================================
FILE: ppdet/core/workspace.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import importlib
import os
import sys
import yaml
import collections
try:
collectionsAbc = collections.abc
except AttributeError:
collectionsAbc = collections
from .config.schema import SchemaDict, SharedConfig, extract_schema
from .config.yaml_helpers import serializable
__all__ = [
'global_config',
'load_config',
'merge_config',
'get_registered_modules',
'create',
'register',
'serializable',
'dump_value',
]
def dump_value(value):
# XXX this is hackish, but collections.abc is not available in python 2
if hasattr(value, '__dict__') or isinstance(value, (dict, tuple, list)):
value = yaml.dump(value, default_flow_style=True)
value = value.replace('\n', '')
value = value.replace('...', '')
return "'{}'".format(value)
else:
# primitive types
return str(value)
class AttrDict(dict):
"""Single level attribute dict, NOT recursive"""
def __init__(self, **kwargs):
super(AttrDict, self).__init__()
super(AttrDict, self).update(kwargs)
def __getattr__(self, key):
if key in self:
return self[key]
raise AttributeError("object has no attribute '{}'".format(key))
def __setattr__(self, key, value):
self[key] = value
def copy(self):
new_dict = AttrDict()
for k, v in self.items():
new_dict.update({k: v})
return new_dict
global_config = AttrDict()
BASE_KEY = '_BASE_'
# parse and load _BASE_ recursively
def _load_config_with_base(file_path):
with open(file_path) as f:
file_cfg = yaml.load(f, Loader=yaml.Loader)
# NOTE: cfgs outside have higher priority than cfgs in _BASE_
if BASE_KEY in file_cfg:
all_base_cfg = AttrDict()
base_ymls = list(file_cfg[BASE_KEY])
for base_yml in base_ymls:
if base_yml.startswith("~"):
base_yml = os.path.expanduser(base_yml)
if not base_yml.startswith('/'):
base_yml = os.path.join(os.path.dirname(file_path), base_yml)
with open(base_yml) as f:
base_cfg = _load_config_with_base(base_yml)
all_base_cfg = merge_config(base_cfg, all_base_cfg)
del file_cfg[BASE_KEY]
return merge_config(file_cfg, all_base_cfg)
return file_cfg
def load_config(file_path):
"""
Load config from file.
Args:
file_path (str): Path of the config file to be loaded.
Returns: global config
"""
_, ext = os.path.splitext(file_path)
assert ext in ['.yml', '.yaml'], "only support yaml files for now"
# load config from file and merge into global config
cfg = _load_config_with_base(file_path)
cfg['filename'] = os.path.splitext(os.path.split(file_path)[-1])[0]
merge_config(cfg)
return global_config
def dict_merge(dct, merge_dct):
""" Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
``dct``.
Args:
dct: dict onto which the merge is executed
merge_dct: dct merged into dct
Returns: dct
"""
for k, v in merge_dct.items():
if (k in dct and isinstance(dct[k], dict) and
isinstance(merge_dct[k], collectionsAbc.Mapping)):
dict_merge(dct[k], merge_dct[k])
else:
dct[k] = merge_dct[k]
return dct
def merge_config(config, another_cfg=None):
"""
Merge config into global config or another_cfg.
Args:
config (dict): Config to be merged.
Returns: global config
"""
global global_config
dct = another_cfg or global_config
return dict_merge(dct, config)
def get_registered_modules():
return {k: v for k, v in global_config.items() if isinstance(v, SchemaDict)}
def make_partial(cls):
op_module = importlib.import_module(cls.__op__.__module__)
op = getattr(op_module, cls.__op__.__name__)
cls.__category__ = getattr(cls, '__category__', None) or 'op'
def partial_apply(self, *args, **kwargs):
kwargs_ = self.__dict__.copy()
kwargs_.update(kwargs)
return op(*args, **kwargs_)
if getattr(cls, '__append_doc__', True): # XXX should default to True?
if sys.version_info[0] > 2:
cls.__doc__ = "Wrapper for `{}` OP".format(op.__name__)
cls.__init__.__doc__ = op.__doc__
cls.__call__ = partial_apply
cls.__call__.__doc__ = op.__doc__
else:
# XXX work around for python 2
partial_apply.__doc__ = op.__doc__
cls.__call__ = partial_apply
return cls
def register(cls):
"""
Register a given module class.
Args:
cls (type): Module class to be registered.
Returns: cls
"""
if cls.__name__ in global_config:
raise ValueError("Module class already registered: {}".format(
cls.__name__))
if hasattr(cls, '__op__'):
cls = make_partial(cls)
global_config[cls.__name__] = extract_schema(cls)
return cls
def create(cls_or_name, **kwargs):
"""
Create an instance of given module class.
Args:
cls_or_name (type or str): Class of which to create instance.
Returns: instance of type `cls_or_name`
"""
assert type(cls_or_name) in [type, str
], "should be a class or name of a class"
name = type(cls_or_name) == str and cls_or_name or cls_or_name.__name__
if name in global_config:
if isinstance(global_config[name], SchemaDict):
pass
elif hasattr(global_config[name], "__dict__"):
# support instance return directly
return global_config[name]
else:
raise ValueError("The module {} is not registered".format(name))
else:
raise ValueError("The module {} is not registered".format(name))
config = global_config[name]
cls = getattr(config.pymodule, name)
cls_kwargs = {}
cls_kwargs.update(global_config[name])
# parse `shared` annoation of registered modules
if getattr(config, 'shared', None):
for k in config.shared:
target_key = config[k]
shared_conf = config.schema[k].default
assert isinstance(shared_conf, SharedConfig)
if target_key is not None and not isinstance(target_key,
SharedConfig):
continue # value is given for the module
elif shared_conf.key in global_config:
# `key` is present in config
cls_kwargs[k] = global_config[shared_conf.key]
else:
cls_kwargs[k] = shared_conf.default_value
# parse `inject` annoation of registered modules
if getattr(cls, 'from_config', None):
cls_kwargs.update(cls.from_config(config, **kwargs))
if getattr(config, 'inject', None):
for k in config.inject:
target_key = config[k]
# optional dependency
if target_key is None:
continue
if isinstance(target_key, dict) or hasattr(target_key, '__dict__'):
if 'name' not in target_key.keys():
continue
inject_name = str(target_key['name'])
if inject_name not in global_config:
raise ValueError(
"Missing injection name {} and check it's name in cfg file".
format(k))
target = global_config[inject_name]
for i, v in target_key.items():
if i == 'name':
continue
target[i] = v
if isinstance(target, SchemaDict):
cls_kwargs[k] = create(inject_name)
elif isinstance(target_key, str):
if target_key not in global_config:
raise ValueError("Missing injection config:", target_key)
target = global_config[target_key]
if isinstance(target, SchemaDict):
cls_kwargs[k] = create(target_key)
elif hasattr(target, '__dict__'): # serialized object
cls_kwargs[k] = target
else:
raise ValueError("Unsupported injection type:", target_key)
# prevent modification of global config values of reference types
# (e.g., list, dict) from within the created module instances
#kwargs = copy.deepcopy(kwargs)
return cls(**cls_kwargs)
================================================
FILE: ppdet/data/__init__.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from . import source
from . import transform
from . import reader
from .source import *
from .transform import *
from .reader import *
================================================
FILE: ppdet/data/crop_utils/__init__.py
================================================
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
================================================
FILE: ppdet/data/crop_utils/annotation_cropper.py
================================================
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import math
import random
import numpy as np
from copy import deepcopy
from typing import List, Tuple
from collections import defaultdict
from .chip_box_utils import nms, transform_chip_boxes2image_boxes
from .chip_box_utils import find_chips_to_cover_overlaped_boxes
from .chip_box_utils import transform_chip_box
from .chip_box_utils import intersection_over_box
class AnnoCropper(object):
def __init__(self,
image_target_sizes: List[int],
valid_box_ratio_ranges: List[List[float]],
chip_target_size: int,
chip_target_stride: int,
use_neg_chip: bool=False,
max_neg_num_per_im: int=8,
max_per_img: int=-1,
nms_thresh: int=0.5):
"""
Generate chips by chip_target_size and chip_target_stride.
These two parameters just like kernel_size and stride in cnn.
Each image has its raw size. After resizing, then get its target size.
The resizing scale = target_size / raw_size.
So are chips of the image.
box_ratio = box_raw_size / image_raw_size = box_target_size / image_target_size
The 'size' above mentioned is the size of long-side of image, box or chip.
:param image_target_sizes: [2000, 1000]
:param valid_box_ratio_ranges: [[-1, 0.1],[0.08, -1]]
:param chip_target_size: 500
:param chip_target_stride: 200
"""
self.target_sizes = image_target_sizes
self.valid_box_ratio_ranges = valid_box_ratio_ranges
assert len(self.target_sizes) == len(self.valid_box_ratio_ranges)
self.scale_num = len(self.target_sizes)
self.chip_target_size = chip_target_size # is target size
self.chip_target_stride = chip_target_stride # is target stride
self.use_neg_chip = use_neg_chip
self.max_neg_num_per_im = max_neg_num_per_im
self.max_per_img = max_per_img
self.nms_thresh = nms_thresh
def crop_anno_records(self, records: List[dict]):
"""
The main logic:
# foreach record(image):
# foreach scale:
# 1 generate chips by chip size and stride for each scale
# 2 get pos chips
# - validate boxes: current scale; h,w >= 1
# - find pos chips greedily by valid gt boxes in each scale
# - for every valid gt box, find its corresponding pos chips in each scale
# 3 get neg chips
# - If given proposals, find neg boxes in them which are not in pos chips
# - If got neg boxes in last step, we find neg chips and assign neg boxes to neg chips such as 2.
# 4 sample neg chips if too much each image
# transform this image-scale annotations to chips(pos chips&neg chips) annotations
:param records, standard coco_record but with extra key `proposals`(Px4), which are predicted by stage1
model and maybe have neg boxes in them.
:return: new_records, list of dict like
{
'im_file': 'fake_image1.jpg',
'im_id': np.array([1]), # new _global_chip_id as im_id
'h': h, # chip height
'w': w, # chip width
'is_crowd': is_crowd, # Nx1 -> Mx1
'gt_class': gt_class, # Nx1 -> Mx1
'gt_bbox': gt_bbox, # Nx4 -> Mx4, 4 represents [x1,y1,x2,y2]
'gt_poly': gt_poly, # [None]xN -> [None]xM
'chip': [x1, y1, x2, y2] # added
}
Attention:
------------------------------>x
|
| (x1,y1)------
| | |
| | |
| | |
| | |
| | |
| ----------
| (x2,y2)
|
↓
y
If we use [x1, y1, x2, y2] to represent boxes or chips,
(x1,y1) is the left-top point which is in the box,
but (x2,y2) is the right-bottom point which is not in the box.
So x1 in [0, w-1], x2 in [1, w], y1 in [0, h-1], y2 in [1,h].
And you can use x2-x1 to get width, and you can use image[y1:y2, x1:x2] to get the box area.
"""
self.chip_records = []
self._global_chip_id = 1
for r in records:
self._cur_im_pos_chips = [
] # element: (chip, boxes_idx), chip is [x1, y1, x2, y2], boxes_ids is List[int]
self._cur_im_neg_chips = [] # element: (chip, neg_box_num)
for scale_i in range(self.scale_num):
self._get_current_scale_parameters(scale_i, r)
# Cx4
chips = self._create_chips(r['h'], r['w'], self._cur_scale)
# # dict: chipid->[box_id, ...]
pos_chip2boxes_idx = self._get_valid_boxes_and_pos_chips(
r['gt_bbox'], chips)
# dict: chipid->neg_box_num
neg_chip2box_num = self._get_neg_boxes_and_chips(
chips,
list(pos_chip2boxes_idx.keys()), r.get('proposals', None))
self._add_to_cur_im_chips(chips, pos_chip2boxes_idx,
neg_chip2box_num)
cur_image_records = self._trans_all_chips2annotations(r)
self.chip_records.extend(cur_image_records)
return self.chip_records
def _add_to_cur_im_chips(self, chips, pos_chip2boxes_idx, neg_chip2box_num):
for pos_chipid, boxes_idx in pos_chip2boxes_idx.items():
chip = np.array(chips[pos_chipid]) # copy chips slice
self._cur_im_pos_chips.append((chip, boxes_idx))
if neg_chip2box_num is None:
return
for neg_chipid, neg_box_num in neg_chip2box_num.items():
chip = np.array(chips[neg_chipid])
self._cur_im_neg_chips.append((chip, neg_box_num))
def _trans_all_chips2annotations(self, r):
gt_bbox = r['gt_bbox']
im_file = r['im_file']
is_crowd = r['is_crowd']
gt_class = r['gt_class']
# gt_poly = r['gt_poly'] # [None]xN
# remaining keys: im_id, h, w
chip_records = self._trans_pos_chips2annotations(im_file, gt_bbox,
is_crowd, gt_class)
if not self.use_neg_chip:
return chip_records
sampled_neg_chips = self._sample_neg_chips()
neg_chip_records = self._trans_neg_chips2annotations(im_file,
sampled_neg_chips)
chip_records.extend(neg_chip_records)
return chip_records
def _trans_pos_chips2annotations(self, im_file, gt_bbox, is_crowd,
gt_class):
chip_records = []
for chip, boxes_idx in self._cur_im_pos_chips:
chip_bbox, final_boxes_idx = transform_chip_box(gt_bbox, boxes_idx,
chip)
x1, y1, x2, y2 = chip
chip_h = y2 - y1
chip_w = x2 - x1
rec = {
'im_file': im_file,
'im_id': np.array([self._global_chip_id]),
'h': chip_h,
'w': chip_w,
'gt_bbox': chip_bbox,
'is_crowd': is_crowd[final_boxes_idx].copy(),
'gt_class': gt_class[final_boxes_idx].copy(),
# 'gt_poly': [None] * len(final_boxes_idx),
'chip': chip
}
self._global_chip_id += 1
chip_records.append(rec)
return chip_records
def _sample_neg_chips(self):
pos_num = len(self._cur_im_pos_chips)
neg_num = len(self._cur_im_neg_chips)
sample_num = min(pos_num + 2, self.max_neg_num_per_im)
assert sample_num >= 1
if neg_num <= sample_num:
return self._cur_im_neg_chips
candidate_num = int(sample_num * 1.5)
candidate_neg_chips = sorted(
self._cur_im_neg_chips, key=lambda x: -x[1])[:candidate_num]
random.shuffle(candidate_neg_chips)
sampled_neg_chips = candidate_neg_chips[:sample_num]
return sampled_neg_chips
def _trans_neg_chips2annotations(self,
im_file: str,
sampled_neg_chips: List[Tuple]):
chip_records = []
for chip, neg_box_num in sampled_neg_chips:
x1, y1, x2, y2 = chip
chip_h = y2 - y1
chip_w = x2 - x1
rec = {
'im_file': im_file,
'im_id': np.array([self._global_chip_id]),
'h': chip_h,
'w': chip_w,
'gt_bbox': np.zeros(
(0, 4), dtype=np.float32),
'is_crowd': np.zeros(
(0, 1), dtype=np.int32),
'gt_class': np.zeros(
(0, 1), dtype=np.int32),
# 'gt_poly': [],
'chip': chip
}
self._global_chip_id += 1
chip_records.append(rec)
return chip_records
def _get_current_scale_parameters(self, scale_i, r):
im_size = max(r['h'], r['w'])
im_target_size = self.target_sizes[scale_i]
self._cur_im_size, self._cur_im_target_size = im_size, im_target_size
self._cur_scale = self._get_current_scale(im_target_size, im_size)
self._cur_valid_ratio_range = self.valid_box_ratio_ranges[scale_i]
def _get_current_scale(self, im_target_size, im_size):
return im_target_size / im_size
def _create_chips(self, h: int, w: int, scale: float):
"""
Generate chips by chip_target_size and chip_target_stride.
These two parameters just like kernel_size and stride in cnn.
:return: chips, Cx4, xy in raw size dimension
"""
chip_size = self.chip_target_size # omit target for simplicity
stride = self.chip_target_stride
width = int(scale * w)
height = int(scale * h)
min_chip_location_diff = 20 # in target size
assert chip_size >= stride
chip_overlap = chip_size - stride
if (width - chip_overlap
) % stride > min_chip_location_diff: # 不能被stride整除的部分比较大,则保留
w_steps = max(1, int(math.ceil((width - chip_overlap) / stride)))
else: # 不能被stride整除的部分比较小,则丢弃
w_steps = max(1, int(math.floor((width - chip_overlap) / stride)))
if (height - chip_overlap) % stride > min_chip_location_diff:
h_steps = max(1, int(math.ceil((height - chip_overlap) / stride)))
else:
h_steps = max(1, int(math.floor((height - chip_overlap) / stride)))
chips = list()
for j in range(h_steps):
for i in range(w_steps):
x1 = i * stride
y1 = j * stride
x2 = min(x1 + chip_size, width)
y2 = min(y1 + chip_size, height)
chips.append([x1, y1, x2, y2])
# check chip size
for item in chips:
if item[2] - item[0] > chip_size * 1.1 or item[3] - item[
1] > chip_size * 1.1:
raise ValueError(item)
chips = np.array(chips, dtype=np.float32)
raw_size_chips = chips / scale
return raw_size_chips
def _get_valid_boxes_and_pos_chips(self, gt_bbox, chips):
valid_ratio_range = self._cur_valid_ratio_range
im_size = self._cur_im_size
scale = self._cur_scale
# Nx4 N
valid_boxes, valid_boxes_idx = self._validate_boxes(
valid_ratio_range, im_size, gt_bbox, scale)
# dict: chipid->[box_id, ...]
pos_chip2boxes_idx = self._find_pos_chips(chips, valid_boxes,
valid_boxes_idx)
return pos_chip2boxes_idx
def _validate_boxes(self,
valid_ratio_range: List[float],
im_size: int,
gt_boxes: 'np.array of Nx4',
scale: float):
"""
:return: valid_boxes: Nx4, valid_boxes_idx: N
"""
ws = (gt_boxes[:, 2] - gt_boxes[:, 0]).astype(np.int32)
hs = (gt_boxes[:, 3] - gt_boxes[:, 1]).astype(np.int32)
maxs = np.maximum(ws, hs)
box_ratio = maxs / im_size
mins = np.minimum(ws, hs)
target_mins = mins * scale
low = valid_ratio_range[0] if valid_ratio_range[0] > 0 else 0
high = valid_ratio_range[1] if valid_ratio_range[1] > 0 else np.finfo(
np.float32).max
valid_boxes_idx = np.nonzero((low <= box_ratio) & (box_ratio < high) & (
target_mins >= 2))[0]
valid_boxes = gt_boxes[valid_boxes_idx]
return valid_boxes, valid_boxes_idx
def _find_pos_chips(self,
chips: 'Cx4',
valid_boxes: 'Bx4',
valid_boxes_idx: 'B'):
"""
:return: pos_chip2boxes_idx, dict: chipid->[box_id, ...]
"""
iob = intersection_over_box(chips, valid_boxes) # overlap, CxB
iob_threshold_to_find_chips = 1.
pos_chip_ids, _ = self._find_chips_to_cover_overlaped_boxes(
iob, iob_threshold_to_find_chips)
pos_chip_ids = set(pos_chip_ids)
iob_threshold_to_assign_box = 0.5
pos_chip2boxes_idx = self._assign_boxes_to_pos_chips(
iob, iob_threshold_to_assign_box, pos_chip_ids, valid_boxes_idx)
return pos_chip2boxes_idx
def _find_chips_to_cover_overlaped_boxes(self, iob, overlap_threshold):
return find_chips_to_cover_overlaped_boxes(iob, overlap_threshold)
def _assign_boxes_to_pos_chips(self, iob, overlap_threshold, pos_chip_ids,
valid_boxes_idx):
chip_ids, box_ids = np.nonzero(iob >= overlap_threshold)
pos_chip2boxes_idx = defaultdict(list)
for chip_id, box_id in zip(chip_ids, box_ids):
if chip_id not in pos_chip_ids:
continue
raw_gt_box_idx = valid_boxes_idx[box_id]
pos_chip2boxes_idx[chip_id].append(raw_gt_box_idx)
return pos_chip2boxes_idx
def _get_neg_boxes_and_chips(self,
chips: 'Cx4',
pos_chip_ids: 'D',
proposals: 'Px4'):
"""
:param chips:
:param pos_chip_ids:
:param proposals:
:return: neg_chip2box_num, None or dict: chipid->neg_box_num
"""
if not self.use_neg_chip:
return None
# train proposals maybe None
if proposals is None or len(proposals) < 1:
return None
valid_ratio_range = self._cur_valid_ratio_range
im_size = self._cur_im_size
scale = self._cur_scale
valid_props, _ = self._validate_boxes(valid_ratio_range, im_size,
proposals, scale)
neg_boxes = self._find_neg_boxes(chips, pos_chip_ids, valid_props)
neg_chip2box_num = self._find_neg_chips(chips, pos_chip_ids, neg_boxes)
return neg_chip2box_num
def _find_neg_boxes(self,
chips: 'Cx4',
pos_chip_ids: 'D',
valid_props: 'Px4'):
"""
:return: neg_boxes: Nx4
"""
if len(pos_chip_ids) == 0:
return valid_props
pos_chips = chips[pos_chip_ids]
iob = intersection_over_box(pos_chips, valid_props)
overlap_per_prop = np.max(iob, axis=0)
non_overlap_props_idx = overlap_per_prop < 0.5
neg_boxes = valid_props[non_overlap_props_idx]
return neg_boxes
def _find_neg_chips(self, chips: 'Cx4', pos_chip_ids: 'D',
neg_boxes: 'Nx4'):
"""
:return: neg_chip2box_num, dict: chipid->neg_box_num
"""
neg_chip_ids = np.setdiff1d(np.arange(len(chips)), pos_chip_ids)
neg_chips = chips[neg_chip_ids]
iob = intersection_over_box(neg_chips, neg_boxes)
iob_threshold_to_find_chips = 0.7
chosen_neg_chip_ids, chip_id2overlap_box_num = \
self._find_chips_to_cover_overlaped_boxes(iob, iob_threshold_to_find_chips)
neg_chipid2box_num = {}
for cid in chosen_neg_chip_ids:
box_num = chip_id2overlap_box_num[cid]
raw_chip_id = neg_chip_ids[cid]
neg_chipid2box_num[raw_chip_id] = box_num
return neg_chipid2box_num
def crop_infer_anno_records(self, records: List[dict]):
"""
transform image record to chips record
:param records:
:return: new_records, list of dict like
{
'im_file': 'fake_image1.jpg',
'im_id': np.array([1]), # new _global_chip_id as im_id
'h': h, # chip height
'w': w, # chip width
'chip': [x1, y1, x2, y2] # added
'ori_im_h': ori_im_h # added, origin image height
'ori_im_w': ori_im_w # added, origin image width
'scale_i': 0 # added,
}
"""
self.chip_records = []
self._global_chip_id = 1 # im_id start from 1
self._global_chip_id2img_id = {}
for r in records:
for scale_i in range(self.scale_num):
self._get_current_scale_parameters(scale_i, r)
# Cx4
chips = self._create_chips(r['h'], r['w'], self._cur_scale)
cur_img_chip_record = self._get_chips_records(r, chips, scale_i)
self.chip_records.extend(cur_img_chip_record)
return self.chip_records
def _get_chips_records(self, rec, chips, scale_i):
cur_img_chip_records = []
ori_im_h = rec["h"]
ori_im_w = rec["w"]
im_file = rec["im_file"]
ori_im_id = rec["im_id"]
for id, chip in enumerate(chips):
chip_rec = {}
x1, y1, x2, y2 = chip
chip_h = y2 - y1
chip_w = x2 - x1
chip_rec["im_file"] = im_file
chip_rec["im_id"] = self._global_chip_id
chip_rec["h"] = chip_h
chip_rec["w"] = chip_w
chip_rec["chip"] = chip
chip_rec["ori_im_h"] = ori_im_h
chip_rec["ori_im_w"] = ori_im_w
chip_rec["scale_i"] = scale_i
self._global_chip_id2img_id[self._global_chip_id] = int(ori_im_id)
self._global_chip_id += 1
cur_img_chip_records.append(chip_rec)
return cur_img_chip_records
def aggregate_chips_detections(self, results, records=None):
"""
# 1. transform chip dets to image dets
# 2. nms boxes per image;
# 3. format output results
:param results:
:param roidb:
:return:
"""
results = deepcopy(results)
records = records if records else self.chip_records
img_id2bbox = self._transform_chip2image_bboxes(results, records)
nms_img_id2bbox = self._nms_dets(img_id2bbox)
aggregate_results = self._reformat_results(nms_img_id2bbox)
return aggregate_results
def _transform_chip2image_bboxes(self, results, records):
# 1. Transform chip dets to image dets;
# 2. Filter valid range;
# 3. Reformat and Aggregate chip dets to Get scale_cls_dets
img_id2bbox = defaultdict(list)
for result in results:
bbox_locs = result['bbox']
bbox_nums = result['bbox_num']
if len(bbox_locs) == 1 and bbox_locs[0][
0] == -1: # current batch has no detections
# bbox_locs = array([[-1.]], dtype=float32); bbox_nums = [[1]]
# MultiClassNMS output: If there is no detected boxes for all images, lod will be set to {1} and Out only contains one value which is -1.
continue
im_ids = result['im_id'] # replace with range(len(bbox_nums))
last_bbox_num = 0
for idx, im_id in enumerate(im_ids):
cur_bbox_len = bbox_nums[idx]
bboxes = bbox_locs[last_bbox_num:last_bbox_num + cur_bbox_len]
last_bbox_num += cur_bbox_len
# box: [num_id, score, xmin, ymin, xmax, ymax]
if len(bboxes) == 0: # current image has no detections
continue
chip_rec = records[int(im_id) -
1] # im_id starts from 1, type is np.int64
image_size = max(chip_rec["ori_im_h"], chip_rec["ori_im_w"])
bboxes = transform_chip_boxes2image_boxes(
bboxes, chip_rec["chip"], chip_rec["ori_im_h"],
chip_rec["ori_im_w"])
scale_i = chip_rec["scale_i"]
cur_scale = self._get_current_scale(self.target_sizes[scale_i],
image_size)
_, valid_boxes_idx = self._validate_boxes(
self.valid_box_ratio_ranges[scale_i], image_size,
bboxes[:, 2:], cur_scale)
ori_img_id = self._global_chip_id2img_id[int(im_id)]
img_id2bbox[ori_img_id].append(bboxes[valid_boxes_idx])
return img_id2bbox
def _nms_dets(self, img_id2bbox):
# 1. NMS on each image-class
# 2. Limit number of detections to MAX_PER_IMAGE if requested
max_per_img = self.max_per_img
nms_thresh = self.nms_thresh
for img_id in img_id2bbox:
box = img_id2bbox[
img_id] # list of np.array of shape [N, 6], 6 is [label, score, x1, y1, x2, y2]
box = np.concatenate(box, axis=0)
nms_dets = nms(box, nms_thresh)
if max_per_img > 0:
if len(nms_dets) > max_per_img:
keep = np.argsort(-nms_dets[:, 1])[:max_per_img]
nms_dets = nms_dets[keep]
img_id2bbox[img_id] = nms_dets
return img_id2bbox
def _reformat_results(self, img_id2bbox):
"""reformat results"""
im_ids = img_id2bbox.keys()
results = []
for img_id in im_ids: # output by original im_id order
if len(img_id2bbox[img_id]) == 0:
bbox = np.array(
[[-1., 0., 0., 0., 0., 0.]]) # edge case: no detections
bbox_num = np.array([0])
else:
# np.array of shape [N, 6], 6 is [label, score, x1, y1, x2, y2]
bbox = img_id2bbox[img_id]
bbox_num = np.array([len(bbox)])
res = dict(im_id=np.array([[img_id]]), bbox=bbox, bbox_num=bbox_num)
results.append(res)
return results
================================================
FILE: ppdet/data/crop_utils/chip_box_utils.py
================================================
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
def bbox_area(boxes):
return (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])
def intersection_over_box(chips, boxes):
"""
intersection area over box area
:param chips: C
:param boxes: B
:return: iob, CxB
"""
M = chips.shape[0]
N = boxes.shape[0]
if M * N == 0:
return np.zeros([M, N], dtype='float32')
box_area = bbox_area(boxes) # B
inter_x2y2 = np.minimum(np.expand_dims(chips, 1)[:, :, 2:],
boxes[:, 2:]) # CxBX2
inter_x1y1 = np.maximum(np.expand_dims(chips, 1)[:, :, :2],
boxes[:, :2]) # CxBx2
inter_wh = inter_x2y2 - inter_x1y1
inter_wh = np.clip(inter_wh, a_min=0, a_max=None)
inter_area = inter_wh[:, :, 0] * inter_wh[:, :, 1] # CxB
iob = inter_area / np.expand_dims(box_area, 0)
return iob
def clip_boxes(boxes, im_shape):
"""
Clip boxes to image boundaries.
:param boxes: [N, 4]
:param im_shape: tuple of 2, [h, w]
:return: [N, 4]
"""
# x1 >= 0
boxes[:, 0] = np.clip(boxes[:, 0], 0, im_shape[1] - 1)
# y1 >= 0
boxes[:, 1] = np.clip(boxes[:, 1], 0, im_shape[0] - 1)
# x2 < im_shape[1]
boxes[:, 2] = np.clip(boxes[:, 2], 1, im_shape[1])
# y2 < im_shape[0]
boxes[:, 3] = np.clip(boxes[:, 3], 1, im_shape[0])
return boxes
def transform_chip_box(gt_bbox: 'Gx4', boxes_idx: 'B', chip: '4'):
boxes_idx = np.array(boxes_idx)
cur_gt_bbox = gt_bbox[boxes_idx].copy() # Bx4
x1, y1, x2, y2 = chip
cur_gt_bbox[:, 0] -= x1
cur_gt_bbox[:, 1] -= y1
cur_gt_bbox[:, 2] -= x1
cur_gt_bbox[:, 3] -= y1
h = y2 - y1
w = x2 - x1
cur_gt_bbox = clip_boxes(cur_gt_bbox, (h, w))
ws = (cur_gt_bbox[:, 2] - cur_gt_bbox[:, 0]).astype(np.int32)
hs = (cur_gt_bbox[:, 3] - cur_gt_bbox[:, 1]).astype(np.int32)
valid_idx = (ws >= 2) & (hs >= 2)
return cur_gt_bbox[valid_idx], boxes_idx[valid_idx]
def find_chips_to_cover_overlaped_boxes(iob, overlap_threshold):
chip_ids, box_ids = np.nonzero(iob >= overlap_threshold)
chip_id2overlap_box_num = np.bincount(chip_ids) # 1d array
chip_id2overlap_box_num = np.pad(
chip_id2overlap_box_num, (0, len(iob) - len(chip_id2overlap_box_num)),
constant_values=0)
chosen_chip_ids = []
while len(box_ids) > 0:
value_counts = np.bincount(chip_ids) # 1d array
max_count_chip_id = np.argmax(value_counts)
assert max_count_chip_id not in chosen_chip_ids
chosen_chip_ids.append(max_count_chip_id)
box_ids_in_cur_chip = box_ids[chip_ids == max_count_chip_id]
ids_not_in_cur_boxes_mask = np.logical_not(
np.isin(box_ids, box_ids_in_cur_chip))
chip_ids = chip_ids[ids_not_in_cur_boxes_mask]
box_ids = box_ids[ids_not_in_cur_boxes_mask]
return chosen_chip_ids, chip_id2overlap_box_num
def transform_chip_boxes2image_boxes(chip_boxes, chip, img_h, img_w):
chip_boxes = np.array(sorted(chip_boxes, key=lambda item: -item[1]))
xmin, ymin, _, _ = chip
# Transform to origin image loc
chip_boxes[:, 2] += xmin
chip_boxes[:, 4] += xmin
chip_boxes[:, 3] += ymin
chip_boxes[:, 5] += ymin
chip_boxes = clip_boxes(chip_boxes, (img_h, img_w))
return chip_boxes
def nms(dets, thresh):
"""Apply classic DPM-style greedy NMS."""
if dets.shape[0] == 0:
return dets[[], :]
scores = dets[:, 1]
x1 = dets[:, 2]
y1 = dets[:, 3]
x2 = dets[:, 4]
y2 = dets[:, 5]
areas = (x2 - x1 + 1) * (y2 - y1 + 1)
order = scores.argsort()[::-1]
ndets = dets.shape[0]
suppressed = np.zeros((ndets), dtype=np.int32)
# nominal indices
# _i, _j
# sorted indices
# i, j
# temp variables for box i's (the box currently under consideration)
# ix1, iy1, ix2, iy2, iarea
# variables for computing overlap with box j (lower scoring box)
# xx1, yy1, xx2, yy2
# w, h
# inter, ovr
for _i in range(ndets):
i = order[_i]
if suppressed[i] == 1:
continue
ix1 = x1[i]
iy1 = y1[i]
ix2 = x2[i]
iy2 = y2[i]
iarea = areas[i]
for _j in range(_i + 1, ndets):
j = order[_j]
if suppressed[j] == 1:
continue
xx1 = max(ix1, x1[j])
yy1 = max(iy1, y1[j])
xx2 = min(ix2, x2[j])
yy2 = min(iy2, y2[j])
w = max(0.0, xx2 - xx1 + 1)
h = max(0.0, yy2 - yy1 + 1)
inter = w * h
ovr = inter / (iarea + areas[j] - inter)
if ovr >= thresh:
suppressed[j] = 1
keep = np.where(suppressed == 0)[0]
dets = dets[keep, :]
return dets
================================================
FILE: ppdet/data/culane_utils.py
================================================
import math
import numpy as np
from imgaug.augmentables.lines import LineString
from scipy.interpolate import InterpolatedUnivariateSpline
def lane_to_linestrings(lanes):
lines = []
for lane in lanes:
lines.append(LineString(lane))
return lines
def linestrings_to_lanes(lines):
lanes = []
for line in lines:
lanes.append(line.coords)
return lanes
def sample_lane(points, sample_ys, img_w):
# this function expects the points to be sorted
points = np.array(points)
if not np.all(points[1:, 1] < points[:-1, 1]):
raise Exception('Annotaion points have to be sorted')
x, y = points[:, 0], points[:, 1]
# interpolate points inside domain
assert len(points) > 1
interp = InterpolatedUnivariateSpline(
y[::-1], x[::-1], k=min(3, len(points) - 1))
domain_min_y = y.min()
domain_max_y = y.max()
sample_ys_inside_domain = sample_ys[(sample_ys >= domain_min_y) & (
sample_ys <= domain_max_y)]
assert len(sample_ys_inside_domain) > 0
interp_xs = interp(sample_ys_inside_domain)
# extrapolate lane to the bottom of the image with a straight line using the 2 points closest to the bottom
two_closest_points = points[:2]
extrap = np.polyfit(
two_closest_points[:, 1], two_closest_points[:, 0], deg=1)
extrap_ys = sample_ys[sample_ys > domain_max_y]
extrap_xs = np.polyval(extrap, extrap_ys)
all_xs = np.hstack((extrap_xs, interp_xs))
# separate between inside and outside points
inside_mask = (all_xs >= 0) & (all_xs < img_w)
xs_inside_image = all_xs[inside_mask]
xs_outside_image = all_xs[~inside_mask]
return xs_outside_image, xs_inside_image
def filter_lane(lane):
assert lane[-1][1] <= lane[0][1]
filtered_lane = []
used = set()
for p in lane:
if p[1] not in used:
filtered_lane.append(p)
used.add(p[1])
return filtered_lane
def transform_annotation(img_w, img_h, max_lanes, n_offsets, offsets_ys,
n_strips, strip_size, anno):
old_lanes = anno['lanes']
# removing lanes with less than 2 points
old_lanes = filter(lambda x: len(x) > 1, old_lanes)
# sort lane points by Y (bottom to top of the image)
old_lanes = [sorted(lane, key=lambda x: -x[1]) for lane in old_lanes]
# remove points with same Y (keep first occurrence)
old_lanes = [filter_lane(lane) for lane in old_lanes]
# normalize the annotation coordinates
old_lanes = [[[x * img_w / float(img_w), y * img_h / float(img_h)]
for x, y in lane] for lane in old_lanes]
# create tranformed annotations
lanes = np.ones(
(max_lanes, 2 + 1 + 1 + 2 + n_offsets), dtype=np.float32
) * -1e5 # 2 scores, 1 start_y, 1 start_x, 1 theta, 1 length, S+1 coordinates
lanes_endpoints = np.ones((max_lanes, 2))
# lanes are invalid by default
lanes[:, 0] = 1
lanes[:, 1] = 0
for lane_idx, lane in enumerate(old_lanes):
if lane_idx >= max_lanes:
break
try:
xs_outside_image, xs_inside_image = sample_lane(lane, offsets_ys,
img_w)
except AssertionError:
continue
if len(xs_inside_image) <= 1:
continue
all_xs = np.hstack((xs_outside_image, xs_inside_image))
lanes[lane_idx, 0] = 0
lanes[lane_idx, 1] = 1
lanes[lane_idx, 2] = len(xs_outside_image) / n_strips
lanes[lane_idx, 3] = xs_inside_image[0]
thetas = []
for i in range(1, len(xs_inside_image)):
theta = math.atan(
i * strip_size /
(xs_inside_image[i] - xs_inside_image[0] + 1e-5)) / math.pi
theta = theta if theta > 0 else 1 - abs(theta)
thetas.append(theta)
theta_far = sum(thetas) / len(thetas)
# lanes[lane_idx,
# 4] = (theta_closest + theta_far) / 2 # averaged angle
lanes[lane_idx, 4] = theta_far
lanes[lane_idx, 5] = len(xs_inside_image)
lanes[lane_idx, 6:6 + len(all_xs)] = all_xs
lanes_endpoints[lane_idx, 0] = (len(all_xs) - 1) / n_strips
lanes_endpoints[lane_idx, 1] = xs_inside_image[-1]
new_anno = {
'label': lanes,
'old_anno': anno,
'lane_endpoints': lanes_endpoints
}
return new_anno
================================================
FILE: ppdet/data/reader.py
================================================
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
import os
import traceback
import six
import sys
if sys.version_info >= (3, 0):
pass
else:
pass
import numpy as np
import paddle
import paddle.nn.functional as F
from copy import deepcopy
from paddle.io import DataLoader, DistributedBatchSampler
from .utils import default_collate_fn
from ppdet.core.workspace import register
from . import transform
from .shm_utils import _get_shared_memory_size_in_M
from ppdet.utils.logger import setup_logger
logger = setup_logger('reader')
MAIN_PID = os.getpid()
class Compose(object):
def __init__(self, transforms, num_classes=80):
self.transforms = transforms
self.transforms_cls = []
for t in self.transforms:
for k, v in t.items():
op_cls = getattr(transform, k)
f = op_cls(**v)
if hasattr(f, 'num_classes'):
f.num_classes = num_classes
self.transforms_cls.append(f)
def _update_transforms_cls(self, data):
if 'transform_schedulers' in data:
def is_valid(op):
op_name = op.__class__.__name__
for t in data['transform_schedulers']:
for k, v in t.items():
if op_name == k:
# [start_epoch, stop_epoch)
start_epoch = v.get('start_epoch', 0)
if start_epoch > data['curr_epoch']:
return False
stop_epoch = v.get('stop_epoch', float('inf'))
if stop_epoch <= data['curr_epoch']:
return False
return True
return filter(is_valid, self.transforms_cls)
else:
return self.transforms_cls
def __call__(self, data):
transforms_cls = self._update_transforms_cls(data)
for f in transforms_cls:
try:
data = f(data)
except Exception as e:
stack_info = traceback.format_exc()
logger.warning("fail to map sample transform [{}] "
"with error: {} and stack:\n{}".format(
f, e, str(stack_info)))
raise e
return data
class BatchCompose(Compose):
def __init__(self, transforms, num_classes=80, collate_batch=True):
super(BatchCompose, self).__init__(transforms, num_classes)
self.collate_batch = collate_batch
def __call__(self, data):
transforms_cls = self._update_transforms_cls(data[0])
for f in transforms_cls:
try:
data = f(data)
except Exception as e:
stack_info = traceback.format_exc()
logger.warning("fail to map batch transform [{}] "
"with error: {} and stack:\n{}".format(
f, e, str(stack_info)))
raise e
# remove keys which is not needed by model
extra_key = ['h', 'w', 'flipped', 'transform_schedulers']
for k in extra_key:
for sample in data:
if k in sample:
sample.pop(k)
# batch data, if user-define batch function needed
# use user-defined here
if self.collate_batch:
batch_data = default_collate_fn(data)
else:
batch_data = {}
for k in data[0].keys():
tmp_data = []
for i in range(len(data)):
tmp_data.append(data[i][k])
if not 'gt_' in k and not 'is_crowd' in k and not 'difficult' in k:
tmp_data = np.stack(tmp_data, axis=0)
if 'origin_' in k:
tmp_data = np.stack(tmp_data, axis=0)
batch_data[k] = tmp_data
return batch_data
class BaseDataLoader(object):
"""
Base DataLoader implementation for detection models
Args:
sample_transforms (list): a list of transforms to perform
on each sample
batch_transforms (list): a list of transforms to perform
on batch
batch_size (int): batch size for batch collating, default 1.
shuffle (bool): whether to shuffle samples
drop_last (bool): whether to drop the last incomplete,
default False
num_classes (int): class number of dataset, default 80
collate_batch (bool): whether to collate batch in dataloader.
If set to True, the samples will collate into batch according
to the batch size. Otherwise, the ground-truth will not collate,
which is used when the number of ground-truch is different in
samples.
use_shared_memory (bool): whether to use shared memory to
accelerate data loading, enable this only if you
are sure that the shared memory size of your OS
is larger than memory cost of input datas of model.
Note that shared memory will be automatically
disabled if the shared memory of OS is less than
1G, which is not enough for detection models.
Default False.
"""
def __init__(self,
sample_transforms=[],
batch_transforms=[],
batch_size=1,
shuffle=False,
drop_last=False,
num_classes=80,
collate_batch=True,
use_shared_memory=False,
**kwargs):
# sample transform
self._sample_transforms = Compose(
sample_transforms, num_classes=num_classes)
# batch transfrom
self._batch_transforms = BatchCompose(batch_transforms, num_classes,
collate_batch)
self.batch_size = batch_size
self.shuffle = shuffle
self.drop_last = drop_last
self.use_shared_memory = use_shared_memory
self.kwargs = kwargs
def __call__(self,
dataset,
worker_num,
batch_sampler=None,
return_list=False):
self.dataset = dataset
self.dataset.check_or_download_dataset()
self.dataset.parse_dataset()
# get data
self.dataset.set_transform(self._sample_transforms)
# set kwargs
self.dataset.set_kwargs(**self.kwargs)
# batch sampler
if batch_sampler is None:
self._batch_sampler = DistributedBatchSampler(
self.dataset,
batch_size=self.batch_size,
shuffle=self.shuffle,
drop_last=self.drop_last)
else:
self._batch_sampler = batch_sampler
# DataLoader do not start sub-process in Windows and Mac
# system, do not need to use shared memory
use_shared_memory = self.use_shared_memory and \
sys.platform not in ['win32', 'darwin']
# check whether shared memory size is bigger than 1G(1024M)
if use_shared_memory:
shm_size = _get_shared_memory_size_in_M()
if shm_size is not None and shm_size < 1024.:
logger.warning("Shared memory size is less than 1G, "
"disable shared_memory in DataLoader")
use_shared_memory = False
self.dataloader = DataLoader(
dataset=self.dataset,
batch_sampler=self._batch_sampler,
collate_fn=self._batch_transforms,
num_workers=worker_num,
return_list=return_list,
use_shared_memory=use_shared_memory)
self.loader = iter(self.dataloader)
return self
def __len__(self):
return len(self._batch_sampler)
def __iter__(self):
return self
def __next__(self):
try:
return next(self.loader)
except StopIteration:
self.loader = iter(self.dataloader)
six.reraise(*sys.exc_info())
def next(self):
# python2 compatibility
return self.__next__()
@register
class TrainReader(BaseDataLoader):
__shared__ = ['num_classes']
def __init__(self,
sample_transforms=[],
batch_transforms=[],
batch_size=1,
shuffle=True,
drop_last=True,
num_classes=80,
collate_batch=True,
**kwargs):
super(TrainReader, self).__init__(sample_transforms, batch_transforms,
batch_size, shuffle, drop_last,
num_classes, collate_batch, **kwargs)
@register
class EvalReader(BaseDataLoader):
__shared__ = ['num_classes']
def __init__(self,
sample_transforms=[],
batch_transforms=[],
batch_size=1,
shuffle=False,
drop_last=False,
num_classes=80,
**kwargs):
super(EvalReader, self).__init__(sample_transforms, batch_transforms,
batch_size, shuffle, drop_last,
num_classes, **kwargs)
@register
class TestReader(BaseDataLoader):
__shared__ = ['num_classes']
def __init__(self,
sample_transforms=[],
batch_transforms=[],
batch_size=1,
shuffle=False,
drop_last=False,
num_classes=80,
**kwargs):
super(TestReader, self).__init__(sample_transforms, batch_transforms,
batch_size, shuffle, drop_last,
num_classes, **kwargs)
@register
class EvalMOTReader(BaseDataLoader):
__shared__ = ['num_classes']
def __init__(self,
sample_transforms=[],
batch_transforms=[],
batch_size=1,
shuffle=False,
drop_last=False,
num_classes=1,
**kwargs):
super(EvalMOTReader, self).__init__(sample_transforms, batch_transforms,
batch_size, shuffle, drop_last,
num_classes, **kwargs)
@register
class TestMOTReader(BaseDataLoader):
__shared__ = ['num_classes']
def __init__(self,
sample_transforms=[],
batch_transforms=[],
batch_size=1,
shuffle=False,
drop_last=False,
num_classes=1,
**kwargs):
super(TestMOTReader, self).__init__(sample_transforms, batch_transforms,
batch_size, shuffle, drop_last,
num_classes, **kwargs)
# For Semi-Supervised Object Detection (SSOD)
class Compose_SSOD(object):
def __init__(self, base_transforms, weak_aug, strong_aug, num_classes=80):
self.base_transforms = base_transforms
self.base_transforms_cls = []
for t in self.base_transforms:
for k, v in t.items():
op_cls = getattr(transform, k)
f = op_cls(**v)
if hasattr(f, 'num_classes'):
f.num_classes = num_classes
self.base_transforms_cls.append(f)
self.weak_augs = weak_aug
self.weak_augs_cls = []
for t in self.weak_augs:
for k, v in t.items():
op_cls = getattr(transform, k)
f = op_cls(**v)
if hasattr(f, 'num_classes'):
f.num_classes = num_classes
self.weak_augs_cls.append(f)
self.strong_augs = strong_aug
self.strong_augs_cls = []
for t in self.strong_augs:
for k, v in t.items():
op_cls = getattr(transform, k)
f = op_cls(**v)
if hasattr(f, 'num_classes'):
f.num_classes = num_classes
self.strong_augs_cls.append(f)
def __call__(self, data):
for f in self.base_transforms_cls:
try:
data = f(data)
except Exception as e:
stack_info = traceback.format_exc()
logger.warning("fail to map sample transform [{}] "
"with error: {} and stack:\n{}".format(
f, e, str(stack_info)))
raise e
weak_data = deepcopy(data)
strong_data = deepcopy(data)
for f in self.weak_augs_cls:
try:
weak_data = f(weak_data)
except Exception as e:
stack_info = traceback.format_exc()
logger.warning("fail to map weak aug [{}] "
"with error: {} and stack:\n{}".format(
f, e, str(stack_info)))
raise e
for f in self.strong_augs_cls:
try:
strong_data = f(strong_data)
except Exception as e:
stack_info = traceback.format_exc()
logger.warning("fail to map strong aug [{}] "
"with error: {} and stack:\n{}".format(
f, e, str(stack_info)))
raise e
weak_data['strong_aug'] = strong_data
return weak_data
class BatchCompose_SSOD(Compose):
def __init__(self, transforms, num_classes=80, collate_batch=True):
super(BatchCompose_SSOD, self).__init__(transforms, num_classes)
self.collate_batch = collate_batch
def __call__(self, data):
# split strong_data from data(weak_data)
strong_data = []
for sample in data:
strong_data.append(sample['strong_aug'])
sample.pop('strong_aug')
for f in self.transforms_cls:
try:
data = f(data)
if 'BatchRandomResizeForSSOD' in f._id:
strong_data = f(strong_data, data[1])[0]
data = data[0]
else:
strong_data = f(strong_data)
except Exception as e:
stack_info = traceback.format_exc()
logger.warning("fail to map batch transform [{}] "
"with error: {} and stack:\n{}".format(
f, e, str(stack_info)))
raise e
# remove keys which is not needed by model
extra_key = ['h', 'w', 'flipped']
for k in extra_key:
for sample in data:
if k in sample:
sample.pop(k)
for sample in strong_data:
if k in sample:
sample.pop(k)
# batch data, if user-define batch function needed
# use user-defined here
if self.collate_batch:
batch_data = default_collate_fn(data)
strong_batch_data = default_collate_fn(strong_data)
return batch_data, strong_batch_data
else:
batch_data = {}
for k in data[0].keys():
tmp_data = []
for i in range(len(data)):
tmp_data.append(data[i][k])
if not 'gt_' in k and not 'is_crowd' in k and not 'difficult' in k:
tmp_data = np.stack(tmp_data, axis=0)
batch_data[k] = tmp_data
strong_batch_data = {}
for k in strong_data[0].keys():
tmp_data = []
for i in range(len(strong_data)):
tmp_data.append(strong_data[i][k])
if not 'gt_' in k and not 'is_crowd' in k and not 'difficult' in k:
tmp_data = np.stack(tmp_data, axis=0)
strong_batch_data[k] = tmp_data
return batch_data, strong_batch_data
class CombineSSODLoader(object):
def __init__(self, label_loader, unlabel_loader):
self.label_loader = label_loader
self.unlabel_loader = unlabel_loader
def __iter__(self):
while True:
try:
label_samples = next(self.label_loader_iter)
except:
self.label_loader_iter = iter(self.label_loader)
label_samples = next(self.label_loader_iter)
try:
unlabel_samples = next(self.unlabel_loader_iter)
except:
self.unlabel_loader_iter = iter(self.unlabel_loader)
unlabel_samples = next(self.unlabel_loader_iter)
yield (
label_samples[0], # sup weak
label_samples[1], # sup strong
unlabel_samples[0], # unsup weak
unlabel_samples[1] # unsup strong
)
def __call__(self):
return self.__iter__()
class BaseSemiDataLoader(object):
def __init__(self,
sample_transforms=[],
weak_aug=[],
strong_aug=[],
sup_batch_transforms=[],
unsup_batch_transforms=[],
sup_batch_size=1,
unsup_batch_size=1,
shuffle=True,
drop_last=True,
num_classes=80,
collate_batch=True,
use_shared_memory=False,
**kwargs):
# sup transforms
self._sample_transforms_label = Compose_SSOD(
sample_transforms, weak_aug, strong_aug, num_classes=num_classes)
self._batch_transforms_label = BatchCompose_SSOD(
sup_batch_transforms, num_classes, collate_batch)
self.batch_size_label = sup_batch_size
# unsup transforms
self._sample_transforms_unlabel = Compose_SSOD(
sample_transforms, weak_aug, strong_aug, num_classes=num_classes)
self._batch_transforms_unlabel = BatchCompose_SSOD(
unsup_batch_transforms, num_classes, collate_batch)
self.batch_size_unlabel = unsup_batch_size
# common
self.shuffle = shuffle
self.drop_last = drop_last
self.use_shared_memory = use_shared_memory
self.kwargs = kwargs
def __call__(self,
dataset_label,
dataset_unlabel,
worker_num,
batch_sampler_label=None,
batch_sampler_unlabel=None,
return_list=False):
# sup dataset
self.dataset_label = dataset_label
self.dataset_label.check_or_download_dataset()
self.dataset_label.parse_dataset()
self.dataset_label.set_transform(self._sample_transforms_label)
self.dataset_label.set_kwargs(**self.kwargs)
if batch_sampler_label is None:
self._batch_sampler_label = DistributedBatchSampler(
self.dataset_label,
batch_size=self.batch_size_label,
shuffle=self.shuffle,
drop_last=self.drop_last)
else:
self._batch_sampler_label = batch_sampler_label
# unsup dataset
self.dataset_unlabel = dataset_unlabel
self.dataset_unlabel.length = self.dataset_label.__len__()
self.dataset_unlabel.check_or_download_dataset()
self.dataset_unlabel.parse_dataset()
self.dataset_unlabel.set_transform(self._sample_transforms_unlabel)
self.dataset_unlabel.set_kwargs(**self.kwargs)
if batch_sampler_unlabel is None:
self._batch_sampler_unlabel = DistributedBatchSampler(
self.dataset_unlabel,
batch_size=self.batch_size_unlabel,
shuffle=self.shuffle,
drop_last=self.drop_last)
else:
self._batch_sampler_unlabel = batch_sampler_unlabel
# DataLoader do not start sub-process in Windows and Mac
# system, do not need to use shared memory
use_shared_memory = self.use_shared_memory and \
sys.platform not in ['win32', 'darwin']
# check whether shared memory size is bigger than 1G(1024M)
if use_shared_memory:
shm_size = _get_shared_memory_size_in_M()
if shm_size is not None and shm_size < 1024.:
logger.warning("Shared memory size is less than 1G, "
"disable shared_memory in DataLoader")
use_shared_memory = False
self.dataloader_label = DataLoader(
dataset=self.dataset_label,
batch_sampler=self._batch_sampler_label,
collate_fn=self._batch_transforms_label,
num_workers=worker_num,
return_list=return_list,
use_shared_memory=use_shared_memory)
self.dataloader_unlabel = DataLoader(
dataset=self.dataset_unlabel,
batch_sampler=self._batch_sampler_unlabel,
collate_fn=self._batch_transforms_unlabel,
num_workers=worker_num,
return_list=return_list,
use_shared_memory=use_shared_memory)
self.dataloader = CombineSSODLoader(self.dataloader_label,
self.dataloader_unlabel)
self.loader = iter(self.dataloader)
return self
def __len__(self):
return len(self._batch_sampler_label)
def __iter__(self):
return self
def __next__(self):
return next(self.loader)
def next(self):
# python2 compatibility
return self.__next__()
@register
class SemiTrainReader(BaseSemiDataLoader):
__shared__ = ['num_classes']
def __init__(self,
sample_transforms=[],
weak_aug=[],
strong_aug=[],
sup_batch_transforms=[],
unsup_batch_transforms=[],
sup_batch_size=1,
unsup_batch_size=1,
shuffle=True,
drop_last=True,
num_classes=80,
collate_batch=True,
**kwargs):
super(SemiTrainReader, self).__init__(
sample_transforms, weak_aug, strong_aug, sup_batch_transforms,
unsup_batch_transforms, sup_batch_size, unsup_batch_size, shuffle,
drop_last, num_classes, collate_batch, **kwargs)
================================================
FILE: ppdet/data/shm_utils.py
================================================
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
SIZE_UNIT = ['K', 'M', 'G', 'T']
SHM_QUERY_CMD = 'df -h'
SHM_KEY = 'shm'
SHM_DEFAULT_MOUNT = '/dev/shm'
# [ shared memory size check ]
# In detection models, image/target data occupies a lot of memory, and
# will occupy lots of shared memory in multi-process DataLoader, we use
# following code to get shared memory size and perform a size check to
# disable shared memory use if shared memory size is not enough.
# Shared memory getting process as follows:
# 1. use `df -h` get all mount info
# 2. pick up spaces whose mount info contains 'shm'
# 3. if 'shm' space number is only 1, return its size
# 4. if there are multiple 'shm' space, try to find the default mount
# directory '/dev/shm' is Linux-like system, otherwise return the
# biggest space size.
def _parse_size_in_M(size_str):
if size_str[-1] == 'B':
num, unit = size_str[:-2], size_str[-2]
else:
num, unit = size_str[:-1], size_str[-1]
assert unit in SIZE_UNIT, \
"unknown shm size unit {}".format(unit)
return float(num) * \
(1024 ** (SIZE_UNIT.index(unit) - 1))
def _get_shared_memory_size_in_M():
try:
df_infos = os.popen(SHM_QUERY_CMD).readlines()
except:
return None
else:
shm_infos = []
for df_info in df_infos:
info = df_info.strip()
if info.find(SHM_KEY) >= 0:
shm_infos.append(info.split())
if len(shm_infos) == 0:
return None
elif len(shm_infos) == 1:
return _parse_size_in_M(shm_infos[0][3])
else:
default_mount_infos = [
si for si in shm_infos if si[-1] == SHM_DEFAULT_MOUNT
]
if default_mount_infos:
return _parse_size_in_M(default_mount_infos[0][3])
else:
return max([_parse_size_in_M(si[3]) for si in shm_infos])
================================================
FILE: ppdet/data/source/__init__.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from . import coco
from . import voc
from . import widerface
from . import category
from . import keypoint_coco
from . import mot
from . import sniper_coco
from . import culane
from . import lvis
from .coco import *
from .voc import *
from .widerface import *
from .category import *
from .keypoint_coco import *
from .mot import *
from .sniper_coco import SniperCOCODataSet
from .dataset import ImageFolder
from .pose3d_cmb import *
from .culane import *
from .lvis import *
================================================
FILE: ppdet/data/source/category.py
================================================
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from ppdet.data.source.voc import pascalvoc_label
from ppdet.data.source.widerface import widerface_label
from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
__all__ = ['get_categories']
def get_categories(metric_type, anno_file=None, arch=None):
"""
Get class id to category id map and category id
to category name map from annotation file.
Args:
metric_type (str): metric type, currently support 'coco', 'voc', 'oid'
and 'widerface'.
anno_file (str): annotation file path
"""
if arch == 'keypoint_arch':
return (None, {'id': 'keypoint'})
if anno_file == None or (not os.path.isfile(anno_file)):
logger.warning(
"anno_file '{}' is None or not set or not exist, "
"please recheck TrainDataset/EvalDataset/TestDataset.anno_path, "
"otherwise the default categories will be used by metric_type.".
format(anno_file))
if metric_type.lower() == 'coco' or metric_type.lower(
) == 'rbox' or metric_type.lower() == 'snipercoco':
if anno_file and os.path.isfile(anno_file):
if anno_file.endswith('json'):
# lazy import pycocotools here
from pycocotools.coco import COCO
coco = COCO(anno_file)
cats = coco.loadCats(coco.getCatIds())
clsid2catid = {i: cat['id'] for i, cat in enumerate(cats)}
catid2name = {cat['id']: cat['name'] for cat in cats}
elif anno_file.endswith('txt'):
cats = []
with open(anno_file) as f:
for line in f.readlines():
cats.append(line.strip())
if cats[0] == 'background': cats = cats[1:]
clsid2catid = {i: i for i in range(len(cats))}
catid2name = {i: name for i, name in enumerate(cats)}
else:
raise ValueError("anno_file {} should be json or txt.".format(
anno_file))
return clsid2catid, catid2name
# anno file not exist, load default categories of COCO17
else:
if metric_type.lower() == 'rbox':
logger.warning(
"metric_type: {}, load default categories of DOTA.".format(
metric_type))
return _dota_category()
logger.warning("metric_type: {}, load default categories of COCO.".
format(metric_type))
return _coco17_category()
elif metric_type.lower() == 'voc':
if anno_file and os.path.isfile(anno_file):
cats = []
with open(anno_file) as f:
for line in f.readlines():
cats.append(line.strip())
if cats[0] == 'background':
cats = cats[1:]
clsid2catid = {i: i for i in range(len(cats))}
catid2name = {i: name for i, name in enumerate(cats)}
return clsid2catid, catid2name
# anno file not exist, load default categories of
# VOC all 20 categories
else:
logger.warning("metric_type: {}, load default categories of VOC.".
format(metric_type))
return _vocall_category()
elif metric_type.lower() == 'oid':
if anno_file and os.path.isfile(anno_file):
logger.warning("only default categories support for OID19")
return _oid19_category()
elif metric_type.lower() == 'widerface':
return _widerface_category()
elif metric_type.lower() in [
'keypointtopdowncocoeval', 'keypointtopdownmpiieval',
'keypointtopdowncocowholebadyhandeval'
]:
return (None, {'id': 'keypoint'})
elif metric_type.lower() == 'pose3deval':
return (None, {'id': 'pose3d'})
elif metric_type.lower() in ['mot', 'motdet', 'reid']:
if anno_file and os.path.isfile(anno_file):
cats = []
with open(anno_file) as f:
for line in f.readlines():
cats.append(line.strip())
if cats[0] == 'background':
cats = cats[1:]
clsid2catid = {i: i for i in range(len(cats))}
catid2name = {i: name for i, name in enumerate(cats)}
return clsid2catid, catid2name
# anno file not exist, load default category 'pedestrian'.
else:
logger.warning(
"metric_type: {}, load default categories of pedestrian MOT.".
format(metric_type))
return _mot_category(category='pedestrian')
elif metric_type.lower() in ['kitti', 'bdd100kmot']:
return _mot_category(category='vehicle')
elif metric_type.lower() in ['mcmot']:
if anno_file and os.path.isfile(anno_file):
cats = []
with open(anno_file) as f:
for line in f.readlines():
cats.append(line.strip())
if cats[0] == 'background':
cats = cats[1:]
clsid2catid = {i: i for i in range(len(cats))}
catid2name = {i: name for i, name in enumerate(cats)}
return clsid2catid, catid2name
# anno file not exist, load default categories of visdrone all 10 categories
else:
logger.warning(
"metric_type: {}, load default categories of VisDrone.".format(
metric_type))
return _visdrone_category()
else:
raise ValueError("unknown metric type {}".format(metric_type))
def _mot_category(category='pedestrian'):
"""
Get class id to category id map and category id
to category name map of mot dataset
"""
label_map = {category: 0}
label_map = sorted(label_map.items(), key=lambda x: x[1])
cats = [l[0] for l in label_map]
clsid2catid = {i: i for i in range(len(cats))}
catid2name = {i: name for i, name in enumerate(cats)}
return clsid2catid, catid2name
def _coco17_category():
"""
Get class id to category id map and category id
to category name map of COCO2017 dataset
"""
clsid2catid = {
1: 1,
2: 2,
3: 3,
4: 4,
5: 5,
6: 6,
7: 7,
8: 8,
9: 9,
10: 10,
11: 11,
12: 13,
13: 14,
14: 15,
15: 16,
16: 17,
17: 18,
18: 19,
19: 20,
20: 21,
21: 22,
22: 23,
23: 24,
24: 25,
25: 27,
26: 28,
27: 31,
28: 32,
29: 33,
30: 34,
31: 35,
32: 36,
33: 37,
34: 38,
35: 39,
36: 40,
37: 41,
38: 42,
39: 43,
40: 44,
41: 46,
42: 47,
43: 48,
44: 49,
45: 50,
46: 51,
47: 52,
48: 53,
49: 54,
50: 55,
51: 56,
52: 57,
53: 58,
54: 59,
55: 60,
56: 61,
57: 62,
58: 63,
59: 64,
60: 65,
61: 67,
62: 70,
63: 72,
64: 73,
65: 74,
66: 75,
67: 76,
68: 77,
69: 78,
70: 79,
71: 80,
72: 81,
73: 82,
74: 84,
75: 85,
76: 86,
77: 87,
78: 88,
79: 89,
80: 90
}
catid2name = {
0: 'background',
1: 'person',
2: 'bicycle',
3: 'car',
4: 'motorcycle',
5: 'airplane',
6: 'bus',
7: 'train',
8: 'truck',
9: 'boat',
10: 'traffic light',
11: 'fire hydrant',
13: 'stop sign',
14: 'parking meter',
15: 'bench',
16: 'bird',
17: 'cat',
18: 'dog',
19: 'horse',
20: 'sheep',
21: 'cow',
22: 'elephant',
23: 'bear',
24: 'zebra',
25: 'giraffe',
27: 'backpack',
28: 'umbrella',
31: 'handbag',
32: 'tie',
33: 'suitcase',
34: 'frisbee',
35: 'skis',
36: 'snowboard',
37: 'sports ball',
38: 'kite',
39: 'baseball bat',
40: 'baseball glove',
41: 'skateboard',
42: 'surfboard',
43: 'tennis racket',
44: 'bottle',
46: 'wine glass',
47: 'cup',
48: 'fork',
49: 'knife',
50: 'spoon',
51: 'bowl',
52: 'banana',
53: 'apple',
54: 'sandwich',
55: 'orange',
56: 'broccoli',
57: 'carrot',
58: 'hot dog',
59: 'pizza',
60: 'donut',
61: 'cake',
62: 'chair',
63: 'couch',
64: 'potted plant',
65: 'bed',
67: 'dining table',
70: 'toilet',
72: 'tv',
73: 'laptop',
74: 'mouse',
75: 'remote',
76: 'keyboard',
77: 'cell phone',
78: 'microwave',
79: 'oven',
80: 'toaster',
81: 'sink',
82: 'refrigerator',
84: 'book',
85: 'clock',
86: 'vase',
87: 'scissors',
88: 'teddy bear',
89: 'hair drier',
90: 'toothbrush'
}
clsid2catid = {k - 1: v for k, v in clsid2catid.items()}
catid2name.pop(0)
return clsid2catid, catid2name
def _dota_category():
"""
Get class id to category id map and category id
to category name map of dota dataset
"""
catid2name = {
0: 'background',
1: 'plane',
2: 'baseball-diamond',
3: 'bridge',
4: 'ground-track-field',
5: 'small-vehicle',
6: 'large-vehicle',
7: 'ship',
8: 'tennis-court',
9: 'basketball-court',
10: 'storage-tank',
11: 'soccer-ball-field',
12: 'roundabout',
13: 'harbor',
14: 'swimming-pool',
15: 'helicopter'
}
catid2name.pop(0)
clsid2catid = {i: i + 1 for i in range(len(catid2name))}
return clsid2catid, catid2name
def _vocall_category():
"""
Get class id to category id map and category id
to category name map of mixup voc dataset
"""
label_map = pascalvoc_label()
label_map = sorted(label_map.items(), key=lambda x: x[1])
cats = [l[0] for l in label_map]
clsid2catid = {i: i for i in range(len(cats))}
catid2name = {i: name for i, name in enumerate(cats)}
return clsid2catid, catid2name
def _widerface_category():
label_map = widerface_label()
label_map = sorted(label_map.items(), key=lambda x: x[1])
cats = [l[0] for l in label_map]
clsid2catid = {i: i for i in range(len(cats))}
catid2name = {i: name for i, name in enumerate(cats)}
return clsid2catid, catid2name
def _oid19_category():
clsid2catid = {k: k + 1 for k in range(500)}
catid2name = {
0: "background",
1: "Infant bed",
2: "Rose",
3: "Flag",
4: "Flashlight",
5: "Sea turtle",
6: "Camera",
7: "Animal",
8: "Glove",
9: "Crocodile",
10: "Cattle",
11: "House",
12: "Guacamole",
13: "Penguin",
14: "Vehicle registration plate",
15: "Bench",
16: "Ladybug",
17: "Human nose",
18: "Watermelon",
19: "Flute",
20: "Butterfly",
21: "Washing machine",
22: "Raccoon",
23: "Segway",
24: "Taco",
25: "Jellyfish",
26: "Cake",
27: "Pen",
28: "Cannon",
29: "Bread",
30: "Tree",
31: "Shellfish",
32: "Bed",
33: "Hamster",
34: "Hat",
35: "Toaster",
36: "Sombrero",
37: "Tiara",
38: "Bowl",
39: "Dragonfly",
40: "Moths and butterflies",
41: "Antelope",
42: "Vegetable",
43: "Torch",
44: "Building",
45: "Power plugs and sockets",
46: "Blender",
47: "Billiard table",
48: "Cutting board",
49: "Bronze sculpture",
50: "Turtle",
51: "Broccoli",
52: "Tiger",
53: "Mirror",
54: "Bear",
55: "Zucchini",
56: "Dress",
57: "Volleyball",
58: "Guitar",
59: "Reptile",
60: "Golf cart",
61: "Tart",
62: "Fedora",
63: "Carnivore",
64: "Car",
65: "Lighthouse",
66: "Coffeemaker",
67: "Food processor",
68: "Truck",
69: "Bookcase",
70: "Surfboard",
71: "Footwear",
72: "Bench",
73: "Necklace",
74: "Flower",
75: "Radish",
76: "Marine mammal",
77: "Frying pan",
78: "Tap",
79: "Peach",
80: "Knife",
81: "Handbag",
82: "Laptop",
83: "Tent",
84: "Ambulance",
85: "Christmas tree",
86: "Eagle",
87: "Limousine",
88: "Kitchen & dining room table",
89: "Polar bear",
90: "Tower",
91: "Football",
92: "Willow",
93: "Human head",
94: "Stop sign",
95: "Banana",
96: "Mixer",
97: "Binoculars",
98: "Dessert",
99: "Bee",
100: "Chair",
101: "Wood-burning stove",
102: "Flowerpot",
103: "Beaker",
104: "Oyster",
105: "Woodpecker",
106: "Harp",
107: "Bathtub",
108: "Wall clock",
109: "Sports uniform",
110: "Rhinoceros",
111: "Beehive",
112: "Cupboard",
113: "Chicken",
114: "Man",
115: "Blue jay",
116: "Cucumber",
117: "Balloon",
118: "Kite",
119: "Fireplace",
120: "Lantern",
121: "Missile",
122: "Book",
123: "Spoon",
124: "Grapefruit",
125: "Squirrel",
126: "Orange",
127: "Coat",
128: "Punching bag",
129: "Zebra",
130: "Billboard",
131: "Bicycle",
132: "Door handle",
133: "Mechanical fan",
134: "Ring binder",
135: "Table",
136: "Parrot",
137: "Sock",
138: "Vase",
139: "Weapon",
140: "Shotgun",
141: "Glasses",
142: "Seahorse",
143: "Belt",
144: "Watercraft",
145: "Window",
146: "Giraffe",
147: "Lion",
148: "Tire",
149: "Vehicle",
150: "Canoe",
151: "Tie",
152: "Shelf",
153: "Picture frame",
154: "Printer",
155: "Human leg",
156: "Boat",
157: "Slow cooker",
158: "Croissant",
159: "Candle",
160: "Pancake",
161: "Pillow",
162: "Coin",
163: "Stretcher",
164: "Sandal",
165: "Woman",
166: "Stairs",
167: "Harpsichord",
168: "Stool",
169: "Bus",
170: "Suitcase",
171: "Human mouth",
172: "Juice",
173: "Skull",
174: "Door",
175: "Violin",
176: "Chopsticks",
177: "Digital clock",
178: "Sunflower",
179: "Leopard",
180: "Bell pepper",
181: "Harbor seal",
182: "Snake",
183: "Sewing machine",
184: "Goose",
185: "Helicopter",
186: "Seat belt",
187: "Coffee cup",
188: "Microwave oven",
189: "Hot dog",
190: "Countertop",
191: "Serving tray",
192: "Dog bed",
193: "Beer",
194: "Sunglasses",
195: "Golf ball",
196: "Waffle",
197: "Palm tree",
198: "Trumpet",
199: "Ruler",
200: "Helmet",
201: "Ladder",
202: "Office building",
203: "Tablet computer",
204: "Toilet paper",
205: "Pomegranate",
206: "Skirt",
207: "Gas stove",
208: "Cookie",
209: "Cart",
210: "Raven",
211: "Egg",
212: "Burrito",
213: "Goat",
214: "Kitchen knife",
215: "Skateboard",
216: "Salt and pepper shakers",
217: "Lynx",
218: "Boot",
219: "Platter",
220: "Ski",
221: "Swimwear",
222: "Swimming pool",
223: "Drinking straw",
224: "Wrench",
225: "Drum",
226: "Ant",
227: "Human ear",
228: "Headphones",
229: "Fountain",
230: "Bird",
231: "Jeans",
232: "Television",
233: "Crab",
234: "Microphone",
235: "Home appliance",
236: "Snowplow",
237: "Beetle",
238: "Artichoke",
239: "Jet ski",
240: "Stationary bicycle",
241: "Human hair",
242: "Brown bear",
243: "Starfish",
244: "Fork",
245: "Lobster",
246: "Corded phone",
247: "Drink",
248: "Saucer",
249: "Carrot",
250: "Insect",
251: "Clock",
252: "Castle",
253: "Tennis racket",
254: "Ceiling fan",
255: "Asparagus",
256: "Jaguar",
257: "Musical instrument",
258: "Train",
259: "Cat",
260: "Rifle",
261: "Dumbbell",
262: "Mobile phone",
263: "Taxi",
264: "Shower",
265: "Pitcher",
266: "Lemon",
267: "Invertebrate",
268: "Turkey",
269: "High heels",
270: "Bust",
271: "Elephant",
272: "Scarf",
273: "Barrel",
274: "Trombone",
275: "Pumpkin",
276: "Box",
277: "Tomato",
278: "Frog",
279: "Bidet",
280: "Human face",
281: "Houseplant",
282: "Van",
283: "Shark",
284: "Ice cream",
285: "Swim cap",
286: "Falcon",
287: "Ostrich",
288: "Handgun",
289: "Whiteboard",
290: "Lizard",
291: "Pasta",
292: "Snowmobile",
293: "Light bulb",
294: "Window blind",
295: "Muffin",
296: "Pretzel",
297: "Computer monitor",
298: "Horn",
299: "Furniture",
300: "Sandwich",
301: "Fox",
302: "Convenience store",
303: "Fish",
304: "Fruit",
305: "Earrings",
306: "Curtain",
307: "Grape",
308: "Sofa bed",
309: "Horse",
310: "Luggage and bags",
311: "Desk",
312: "Crutch",
313: "Bicycle helmet",
314: "Tick",
315: "Airplane",
316: "Canary",
317: "Spatula",
318: "Watch",
319: "Lily",
320: "Kitchen appliance",
321: "Filing cabinet",
322: "Aircraft",
323: "Cake stand",
324: "Candy",
325: "Sink",
326: "Mouse",
327: "Wine",
328: "Wheelchair",
329: "Goldfish",
330: "Refrigerator",
331: "French fries",
332: "Drawer",
333: "Treadmill",
334: "Picnic basket",
335: "Dice",
336: "Cabbage",
337: "Football helmet",
338: "Pig",
339: "Person",
340: "Shorts",
341: "Gondola",
342: "Honeycomb",
343: "Doughnut",
344: "Chest of drawers",
345: "Land vehicle",
346: "Bat",
347: "Monkey",
348: "Dagger",
349: "Tableware",
350: "Human foot",
351: "Mug",
352: "Alarm clock",
353: "Pressure cooker",
354: "Human hand",
355: "Tortoise",
356: "Baseball glove",
357: "Sword",
358: "Pear",
359: "Miniskirt",
360: "Traffic sign",
361: "Girl",
362: "Roller skates",
363: "Dinosaur",
364: "Porch",
365: "Human beard",
366: "Submarine sandwich",
367: "Screwdriver",
368: "Strawberry",
369: "Wine glass",
370: "Seafood",
371: "Racket",
372: "Wheel",
373: "Sea lion",
374: "Toy",
375: "Tea",
376: "Tennis ball",
377: "Waste container",
378: "Mule",
379: "Cricket ball",
380: "Pineapple",
381: "Coconut",
382: "Doll",
383: "Coffee table",
384: "Snowman",
385: "Lavender",
386: "Shrimp",
387: "Maple",
388: "Cowboy hat",
389: "Goggles",
390: "Rugby ball",
391: "Caterpillar",
392: "Poster",
393: "Rocket",
394: "Organ",
395: "Saxophone",
396: "Traffic light",
397: "Cocktail",
398: "Plastic bag",
399: "Squash",
400: "Mushroom",
401: "Hamburger",
402: "Light switch",
403: "Parachute",
404: "Teddy bear",
405: "Winter melon",
406: "Deer",
407: "Musical keyboard",
408: "Plumbing fixture",
409: "Scoreboard",
410: "Baseball bat",
411: "Envelope",
412: "Adhesive tape",
413: "Briefcase",
414: "Paddle",
415: "Bow and arrow",
416: "Telephone",
417: "Sheep",
418: "Jacket",
419: "Boy",
420: "Pizza",
421: "Otter",
422: "Office supplies",
423: "Couch",
424: "Cello",
425: "Bull",
426: "Camel",
427: "Ball",
428: "Duck",
429: "Whale",
430: "Shirt",
431: "Tank",
432: "Motorcycle",
433: "Accordion",
434: "Owl",
435: "Porcupine",
436: "Sun hat",
437: "Nail",
438: "Scissors",
439: "Swan",
440: "Lamp",
441: "Crown",
442: "Piano",
443: "Sculpture",
444: "Cheetah",
445: "Oboe",
446: "Tin can",
447: "Mango",
448: "Tripod",
449: "Oven",
450: "Mouse",
451: "Barge",
452: "Coffee",
453: "Snowboard",
454: "Common fig",
455: "Salad",
456: "Marine invertebrates",
457: "Umbrella",
458: "Kangaroo",
459: "Human arm",
460: "Measuring cup",
461: "Snail",
462: "Loveseat",
463: "Suit",
464: "Teapot",
465: "Bottle",
466: "Alpaca",
467: "Kettle",
468: "Trousers",
469: "Popcorn",
470: "Centipede",
471: "Spider",
472: "Sparrow",
473: "Plate",
474: "Bagel",
475: "Personal care",
476: "Apple",
477: "Brassiere",
478: "Bathroom cabinet",
479: "studio couch",
480: "Computer keyboard",
481: "Table tennis racket",
482: "Sushi",
483: "Cabinetry",
484: "Street light",
485: "Towel",
486: "Nightstand",
487: "Rabbit",
488: "Dolphin",
489: "Dog",
490: "Jug",
491: "Wok",
492: "Fire hydrant",
493: "Human eye",
494: "Skyscraper",
495: "Backpack",
496: "Potato",
497: "Paper towel",
498: "Lifejacket",
499: "Bicycle wheel",
500: "Toilet",
}
return clsid2catid, catid2name
def _visdrone_category():
clsid2catid = {i: i for i in range(10)}
catid2name = {
0: 'pedestrian',
1: 'people',
2: 'bicycle',
3: 'car',
4: 'van',
5: 'truck',
6: 'tricycle',
7: 'awning-tricycle',
8: 'bus',
9: 'motor'
}
return clsid2catid, catid2name
================================================
FILE: ppdet/data/source/coco.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import copy
try:
from collections.abc import Sequence
except Exception:
from collections import Sequence
import numpy as np
from ppdet.core.workspace import register, serializable
from .dataset import DetDataset
from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
__all__ = [
'COCODataSet', 'SlicedCOCODataSet', 'SemiCOCODataSet', 'COCODetDataset', 'COCOInstSegDataset'
]
@register
@serializable
class COCODataSet(DetDataset):
"""
Load dataset with COCO format.
Args:
dataset_dir (str): root directory for dataset.
image_dir (str): directory for images.
anno_path (str): coco annotation file path.
data_fields (list): key name of data dictionary, at least have 'image'.
sample_num (int): number of samples to load, -1 means all.
load_crowd (bool): whether to load crowded ground-truth.
False as default
allow_empty (bool): whether to load empty entry. False as default
empty_ratio (float): the ratio of empty record number to total
record's, if empty_ratio is out of [0. ,1.), do not sample the
records and use all the empty entries. 1. as default
repeat (int): repeat times for dataset, use in benchmark.
"""
def __init__(self,
dataset_dir=None,
image_dir=None,
anno_path=None,
data_fields=['image'],
sample_num=-1,
load_crowd=False,
allow_empty=False,
empty_ratio=1.,
repeat=1):
super(COCODataSet, self).__init__(
dataset_dir,
image_dir,
anno_path,
data_fields,
sample_num,
repeat=repeat)
self.load_image_only = False
self.load_semantic = False
self.load_crowd = load_crowd
self.allow_empty = allow_empty
self.empty_ratio = empty_ratio
def _sample_empty(self, records, num):
# if empty_ratio is out of [0. ,1.), do not sample the records
if self.empty_ratio < 0. or self.empty_ratio >= 1.:
return records
import random
sample_num = min(
int(num * self.empty_ratio / (1 - self.empty_ratio)), len(records))
records = random.sample(records, sample_num)
return records
def parse_dataset(self):
anno_path = os.path.join(self.dataset_dir, self.anno_path)
image_dir = os.path.join(self.dataset_dir, self.image_dir)
assert anno_path.endswith('.json'), \
'invalid coco annotation file: ' + anno_path
from pycocotools.coco import COCO
coco = COCO(anno_path)
img_ids = coco.getImgIds()
img_ids.sort()
cat_ids = coco.getCatIds()
records = []
empty_records = []
ct = 0
self.catid2clsid = dict({catid: i for i, catid in enumerate(cat_ids)})
self.cname2cid = dict({
coco.loadCats(catid)[0]['name']: clsid
for catid, clsid in self.catid2clsid.items()
})
if 'annotations' not in coco.dataset:
self.load_image_only = True
logger.warning('Annotation file: {} does not contains ground truth '
'and load image information only.'.format(anno_path))
for img_id in img_ids:
img_anno = coco.loadImgs([img_id])[0]
im_fname = img_anno['file_name']
im_w = float(img_anno['width'])
im_h = float(img_anno['height'])
im_path = os.path.join(image_dir,
im_fname) if image_dir else im_fname
is_empty = False
if not os.path.exists(im_path):
logger.warning('Illegal image file: {}, and it will be '
'ignored'.format(im_path))
continue
if im_w < 0 or im_h < 0:
logger.warning('Illegal width: {} or height: {} in annotation, '
'and im_id: {} will be ignored'.format(
im_w, im_h, img_id))
continue
coco_rec = {
'im_file': im_path,
'im_id': np.array([img_id]),
'h': im_h,
'w': im_w,
} if 'image' in self.data_fields else {}
if not self.load_image_only:
ins_anno_ids = coco.getAnnIds(
imgIds=[img_id], iscrowd=None if self.load_crowd else False)
instances = coco.loadAnns(ins_anno_ids)
bboxes = []
is_rbox_anno = False
for inst in instances:
# check gt bbox
if inst.get('ignore', False):
continue
if 'bbox' not in inst.keys():
continue
else:
if not any(np.array(inst['bbox'])):
continue
x1, y1, box_w, box_h = inst['bbox']
x2 = x1 + box_w
y2 = y1 + box_h
eps = 1e-5
if inst['area'] > 0 and x2 - x1 > eps and y2 - y1 > eps:
inst['clean_bbox'] = [
round(float(x), 3) for x in [x1, y1, x2, y2]
]
bboxes.append(inst)
else:
logger.warning(
'Found an invalid bbox in annotations: im_id: {}, '
'area: {} x1: {}, y1: {}, x2: {}, y2: {}.'.format(
img_id, float(inst['area']), x1, y1, x2, y2))
num_bbox = len(bboxes)
if num_bbox <= 0 and not self.allow_empty:
continue
elif num_bbox <= 0:
is_empty = True
gt_bbox = np.zeros((num_bbox, 4), dtype=np.float32)
gt_class = np.zeros((num_bbox, 1), dtype=np.int32)
is_crowd = np.zeros((num_bbox, 1), dtype=np.int32)
gt_poly = [None] * num_bbox
gt_track_id = -np.ones((num_bbox, 1), dtype=np.int32)
has_segmentation = False
has_track_id = False
for i, box in enumerate(bboxes):
catid = box['category_id']
gt_class[i][0] = self.catid2clsid[catid]
gt_bbox[i, :] = box['clean_bbox']
is_crowd[i][0] = box['iscrowd']
# check RLE format
if 'segmentation' in box and box['iscrowd'] == 1:
gt_poly[i] = [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]
elif 'segmentation' in box and box['segmentation']:
if not np.array(
box['segmentation'],
dtype=object).size > 0 and not self.allow_empty:
bboxes.pop(i)
gt_poly.pop(i)
np.delete(is_crowd, i)
np.delete(gt_class, i)
np.delete(gt_bbox, i)
else:
gt_poly[i] = box['segmentation']
has_segmentation = True
if 'track_id' in box:
gt_track_id[i][0] = box['track_id']
has_track_id = True
if has_segmentation and not any(
gt_poly) and not self.allow_empty:
continue
gt_rec = {
'is_crowd': is_crowd,
'gt_class': gt_class,
'gt_bbox': gt_bbox,
'gt_poly': gt_poly,
}
if has_track_id:
gt_rec.update({'gt_track_id': gt_track_id})
for k, v in gt_rec.items():
if k in self.data_fields:
coco_rec[k] = v
# TODO: remove load_semantic
if self.load_semantic and 'semantic' in self.data_fields:
seg_path = os.path.join(self.dataset_dir, 'stuffthingmaps',
'train2017', im_fname[:-3] + 'png')
coco_rec.update({'semantic': seg_path})
logger.debug('Load file: {}, im_id: {}, h: {}, w: {}.'.format(
im_path, img_id, im_h, im_w))
if is_empty:
empty_records.append(coco_rec)
else:
records.append(coco_rec)
ct += 1
if self.sample_num > 0 and ct >= self.sample_num:
break
assert ct > 0, 'not found any coco record in %s' % (anno_path)
logger.info('Load [{} samples valid, {} samples invalid] in file {}.'.
format(ct, len(img_ids) - ct, anno_path))
if self.allow_empty and len(empty_records) > 0:
empty_records = self._sample_empty(empty_records, len(records))
records += empty_records
self.roidbs = records
@register
@serializable
class SlicedCOCODataSet(COCODataSet):
"""Sliced COCODataSet"""
def __init__(
self,
dataset_dir=None,
image_dir=None,
anno_path=None,
data_fields=['image'],
sample_num=-1,
load_crowd=False,
allow_empty=False,
empty_ratio=1.,
repeat=1,
sliced_size=[640, 640],
overlap_ratio=[0.25, 0.25], ):
super(SlicedCOCODataSet, self).__init__(
dataset_dir=dataset_dir,
image_dir=image_dir,
anno_path=anno_path,
data_fields=data_fields,
sample_num=sample_num,
load_crowd=load_crowd,
allow_empty=allow_empty,
empty_ratio=empty_ratio,
repeat=repeat, )
self.sliced_size = sliced_size
self.overlap_ratio = overlap_ratio
def parse_dataset(self):
anno_path = os.path.join(self.dataset_dir, self.anno_path)
image_dir = os.path.join(self.dataset_dir, self.image_dir)
assert anno_path.endswith('.json'), \
'invalid coco annotation file: ' + anno_path
from pycocotools.coco import COCO
coco = COCO(anno_path)
img_ids = coco.getImgIds()
img_ids.sort()
cat_ids = coco.getCatIds()
records = []
empty_records = []
ct = 0
ct_sub = 0
self.catid2clsid = dict({catid: i for i, catid in enumerate(cat_ids)})
self.cname2cid = dict({
coco.loadCats(catid)[0]['name']: clsid
for catid, clsid in self.catid2clsid.items()
})
if 'annotations' not in coco.dataset:
self.load_image_only = True
logger.warning('Annotation file: {} does not contains ground truth '
'and load image information only.'.format(anno_path))
try:
import sahi
from sahi.slicing import slice_image
except Exception as e:
logger.error(
'sahi not found, plaese install sahi. '
'for example: `pip install sahi`, see https://github.com/obss/sahi.'
)
raise e
sub_img_ids = 0
for img_id in img_ids:
img_anno = coco.loadImgs([img_id])[0]
im_fname = img_anno['file_name']
im_w = float(img_anno['width'])
im_h = float(img_anno['height'])
im_path = os.path.join(image_dir,
im_fname) if image_dir else im_fname
is_empty = False
if not os.path.exists(im_path):
logger.warning('Illegal image file: {}, and it will be '
'ignored'.format(im_path))
continue
if im_w < 0 or im_h < 0:
logger.warning('Illegal width: {} or height: {} in annotation, '
'and im_id: {} will be ignored'.format(
im_w, im_h, img_id))
continue
slice_image_result = sahi.slicing.slice_image(
image=im_path,
slice_height=self.sliced_size[0],
slice_width=self.sliced_size[1],
overlap_height_ratio=self.overlap_ratio[0],
overlap_width_ratio=self.overlap_ratio[1])
sub_img_num = len(slice_image_result)
for _ind in range(sub_img_num):
im = slice_image_result.images[_ind]
coco_rec = {
'image': im,
'im_id': np.array([sub_img_ids + _ind]),
'h': im.shape[0],
'w': im.shape[1],
'ori_im_id': np.array([img_id]),
'st_pix': np.array(
slice_image_result.starting_pixels[_ind],
dtype=np.float32),
'is_last': 1 if _ind == sub_img_num - 1 else 0,
} if 'image' in self.data_fields else {}
records.append(coco_rec)
ct_sub += sub_img_num
ct += 1
if self.sample_num > 0 and ct >= self.sample_num:
break
assert ct > 0, 'not found any coco record in %s' % (anno_path)
logger.info('{} samples and slice to {} sub_samples in file {}'.format(
ct, ct_sub, anno_path))
if self.allow_empty and len(empty_records) > 0:
empty_records = self._sample_empty(empty_records, len(records))
records += empty_records
self.roidbs = records
@register
@serializable
class SemiCOCODataSet(COCODataSet):
"""Semi-COCODataSet used for supervised and unsupervised dataSet"""
def __init__(self,
dataset_dir=None,
image_dir=None,
anno_path=None,
data_fields=['image'],
sample_num=-1,
load_crowd=False,
allow_empty=False,
empty_ratio=1.,
repeat=1,
supervised=True):
super(SemiCOCODataSet, self).__init__(
dataset_dir, image_dir, anno_path, data_fields, sample_num,
load_crowd, allow_empty, empty_ratio, repeat)
self.supervised = supervised
self.length = -1 # defalut -1 means all
def parse_dataset(self):
anno_path = os.path.join(self.dataset_dir, self.anno_path)
image_dir = os.path.join(self.dataset_dir, self.image_dir)
assert anno_path.endswith('.json'), \
'invalid coco annotation file: ' + anno_path
from pycocotools.coco import COCO
coco = COCO(anno_path)
img_ids = coco.getImgIds()
img_ids.sort()
cat_ids = coco.getCatIds()
records = []
empty_records = []
ct = 0
self.catid2clsid = dict({catid: i for i, catid in enumerate(cat_ids)})
self.cname2cid = dict({
coco.loadCats(catid)[0]['name']: clsid
for catid, clsid in self.catid2clsid.items()
})
if 'annotations' not in coco.dataset or self.supervised == False:
self.load_image_only = True
logger.warning('Annotation file: {} does not contains ground truth '
'and load image information only.'.format(anno_path))
for img_id in img_ids:
img_anno = coco.loadImgs([img_id])[0]
im_fname = img_anno['file_name']
im_w = float(img_anno['width'])
im_h = float(img_anno['height'])
im_path = os.path.join(image_dir,
im_fname) if image_dir else im_fname
is_empty = False
if not os.path.exists(im_path):
logger.warning('Illegal image file: {}, and it will be '
'ignored'.format(im_path))
continue
if im_w < 0 or im_h < 0:
logger.warning('Illegal width: {} or height: {} in annotation, '
'and im_id: {} will be ignored'.format(
im_w, im_h, img_id))
continue
coco_rec = {
'im_file': im_path,
'im_id': np.array([img_id]),
'h': im_h,
'w': im_w,
} if 'image' in self.data_fields else {}
if not self.load_image_only:
ins_anno_ids = coco.getAnnIds(
imgIds=[img_id], iscrowd=None if self.load_crowd else False)
instances = coco.loadAnns(ins_anno_ids)
bboxes = []
is_rbox_anno = False
for inst in instances:
# check gt bbox
if inst.get('ignore', False):
continue
if 'bbox' not in inst.keys():
continue
else:
if not any(np.array(inst['bbox'])):
continue
x1, y1, box_w, box_h = inst['bbox']
x2 = x1 + box_w
y2 = y1 + box_h
eps = 1e-5
if inst['area'] > 0 and x2 - x1 > eps and y2 - y1 > eps:
inst['clean_bbox'] = [
round(float(x), 3) for x in [x1, y1, x2, y2]
]
bboxes.append(inst)
else:
logger.warning(
'Found an invalid bbox in annotations: im_id: {}, '
'area: {} x1: {}, y1: {}, x2: {}, y2: {}.'.format(
img_id, float(inst['area']), x1, y1, x2, y2))
num_bbox = len(bboxes)
if num_bbox <= 0 and not self.allow_empty:
continue
elif num_bbox <= 0:
is_empty = True
gt_bbox = np.zeros((num_bbox, 4), dtype=np.float32)
gt_class = np.zeros((num_bbox, 1), dtype=np.int32)
is_crowd = np.zeros((num_bbox, 1), dtype=np.int32)
gt_poly = [None] * num_bbox
has_segmentation = False
for i, box in enumerate(bboxes):
catid = box['category_id']
gt_class[i][0] = self.catid2clsid[catid]
gt_bbox[i, :] = box['clean_bbox']
is_crowd[i][0] = box['iscrowd']
# check RLE format
if 'segmentation' in box and box['iscrowd'] == 1:
gt_poly[i] = [[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]]
elif 'segmentation' in box and box['segmentation']:
if not np.array(box['segmentation']
).size > 0 and not self.allow_empty:
bboxes.pop(i)
gt_poly.pop(i)
np.delete(is_crowd, i)
np.delete(gt_class, i)
np.delete(gt_bbox, i)
else:
gt_poly[i] = box['segmentation']
has_segmentation = True
if has_segmentation and not any(
gt_poly) and not self.allow_empty:
continue
gt_rec = {
'is_crowd': is_crowd,
'gt_class': gt_class,
'gt_bbox': gt_bbox,
'gt_poly': gt_poly,
}
for k, v in gt_rec.items():
if k in self.data_fields:
coco_rec[k] = v
# TODO: remove load_semantic
if self.load_semantic and 'semantic' in self.data_fields:
seg_path = os.path.join(self.dataset_dir, 'stuffthingmaps',
'train2017', im_fname[:-3] + 'png')
coco_rec.update({'semantic': seg_path})
logger.debug('Load file: {}, im_id: {}, h: {}, w: {}.'.format(
im_path, img_id, im_h, im_w))
if is_empty:
empty_records.append(coco_rec)
else:
records.append(coco_rec)
ct += 1
if self.sample_num > 0 and ct >= self.sample_num:
break
assert ct > 0, 'not found any coco record in %s' % (anno_path)
logger.info('Load [{} samples valid, {} samples invalid] in file {}.'.
format(ct, len(img_ids) - ct, anno_path))
if self.allow_empty and len(empty_records) > 0:
empty_records = self._sample_empty(empty_records, len(records))
records += empty_records
self.roidbs = records
if self.supervised:
logger.info(f'Use {len(self.roidbs)} sup_samples data as LABELED')
else:
if self.length > 0: # unsup length will be decide by sup length
all_roidbs = self.roidbs.copy()
selected_idxs = [
np.random.choice(len(all_roidbs))
for _ in range(self.length)
]
self.roidbs = [all_roidbs[i] for i in selected_idxs]
logger.info(
f'Use {len(self.roidbs)} unsup_samples data as UNLABELED')
def __getitem__(self, idx):
n = len(self.roidbs)
if self.repeat > 1:
idx %= n
# data batch
roidb = copy.deepcopy(self.roidbs[idx])
if self.mixup_epoch == 0 or self._epoch < self.mixup_epoch:
idx = np.random.randint(n)
roidb = [roidb, copy.deepcopy(self.roidbs[idx])]
elif self.cutmix_epoch == 0 or self._epoch < self.cutmix_epoch:
idx = np.random.randint(n)
roidb = [roidb, copy.deepcopy(self.roidbs[idx])]
elif self.mosaic_epoch == 0 or self._epoch < self.mosaic_epoch:
roidb = [roidb, ] + [
copy.deepcopy(self.roidbs[np.random.randint(n)])
for _ in range(4)
]
if isinstance(roidb, Sequence):
for r in roidb:
r['curr_iter'] = self._curr_iter
else:
roidb['curr_iter'] = self._curr_iter
self._curr_iter += 1
return self.transform(roidb)
# for PaddleX
@register
@serializable
class COCODetDataset(COCODataSet):
pass
# for PaddleX
@register
@serializable
class COCOInstSegDataset(COCODataSet):
pass
================================================
FILE: ppdet/data/source/culane.py
================================================
from ppdet.core.workspace import register, serializable
import cv2
import os
import tarfile
import numpy as np
import os.path as osp
from ppdet.data.source.dataset import DetDataset
from imgaug.augmentables.lines import LineStringsOnImage
from imgaug.augmentables.segmaps import SegmentationMapsOnImage
from ppdet.data.culane_utils import lane_to_linestrings
import pickle as pkl
from ppdet.utils.logger import setup_logger
try:
from collections.abc import Sequence
except Exception:
from collections import Sequence
from .dataset import DetDataset, _make_dataset, _is_valid_file
from ppdet.utils.download import download_dataset
logger = setup_logger(__name__)
@register
@serializable
class CULaneDataSet(DetDataset):
def __init__(
self,
dataset_dir,
cut_height,
list_path,
split='train',
data_fields=['image'],
video_file=None,
frame_rate=-1, ):
super(CULaneDataSet, self).__init__(
dataset_dir=dataset_dir,
cut_height=cut_height,
split=split,
data_fields=data_fields)
self.dataset_dir = dataset_dir
self.list_path = osp.join(dataset_dir, list_path)
self.cut_height = cut_height
self.data_fields = data_fields
self.split = split
self.training = 'train' in split
self.data_infos = []
self.video_file = video_file
self.frame_rate = frame_rate
self._imid2path = {}
self.predict_dir = None
def __len__(self):
return len(self.data_infos)
def check_or_download_dataset(self):
if not osp.exists(self.dataset_dir):
download_dataset("dataset", dataset="culane")
# extract .tar files in self.dataset_dir
for fname in os.listdir(self.dataset_dir):
logger.info("Decompressing {}...".format(fname))
# ignore .* files
if fname.startswith('.'):
continue
if fname.find('.tar.gz') >= 0:
with tarfile.open(osp.join(self.dataset_dir, fname)) as tf:
tf.extractall(path=self.dataset_dir)
logger.info("Dataset files are ready.")
def parse_dataset(self):
logger.info('Loading CULane annotations...')
if self.predict_dir is not None:
logger.info('switch to predict mode')
return
# Waiting for the dataset to load is tedious, let's cache it
os.makedirs('cache', exist_ok=True)
cache_path = 'cache/culane_paddle_{}.pkl'.format(self.split)
if os.path.exists(cache_path):
with open(cache_path, 'rb') as cache_file:
self.data_infos = pkl.load(cache_file)
self.max_lanes = max(
len(anno['lanes']) for anno in self.data_infos)
return
with open(self.list_path) as list_file:
for line in list_file:
infos = self.load_annotation(line.split())
self.data_infos.append(infos)
# cache data infos to file
with open(cache_path, 'wb') as cache_file:
pkl.dump(self.data_infos, cache_file)
def load_annotation(self, line):
infos = {}
img_line = line[0]
img_line = img_line[1 if img_line[0] == '/' else 0::]
img_path = os.path.join(self.dataset_dir, img_line)
infos['img_name'] = img_line
infos['img_path'] = img_path
if len(line) > 1:
mask_line = line[1]
mask_line = mask_line[1 if mask_line[0] == '/' else 0::]
mask_path = os.path.join(self.dataset_dir, mask_line)
infos['mask_path'] = mask_path
if len(line) > 2:
exist_list = [int(l) for l in line[2:]]
infos['lane_exist'] = np.array(exist_list)
anno_path = img_path[:
-3] + 'lines.txt' # remove sufix jpg and add lines.txt
with open(anno_path, 'r') as anno_file:
data = [
list(map(float, line.split())) for line in anno_file.readlines()
]
lanes = [[(lane[i], lane[i + 1]) for i in range(0, len(lane), 2)
if lane[i] >= 0 and lane[i + 1] >= 0] for lane in data]
lanes = [list(set(lane)) for lane in lanes] # remove duplicated points
lanes = [lane for lane in lanes
if len(lane) > 2] # remove lanes with less than 2 points
lanes = [sorted(
lane, key=lambda x: x[1]) for lane in lanes] # sort by y
infos['lanes'] = lanes
return infos
def set_images(self, images):
self.predict_dir = images
self.data_infos = self._load_images()
def _find_images(self):
predict_dir = self.predict_dir
if not isinstance(predict_dir, Sequence):
predict_dir = [predict_dir]
images = []
for im_dir in predict_dir:
if os.path.isdir(im_dir):
im_dir = os.path.join(self.predict_dir, im_dir)
images.extend(_make_dataset(im_dir))
elif os.path.isfile(im_dir) and _is_valid_file(im_dir):
images.append(im_dir)
return images
def _load_images(self):
images = self._find_images()
ct = 0
records = []
for image in images:
assert image != '' and os.path.isfile(image), \
"Image {} not found".format(image)
if self.sample_num > 0 and ct >= self.sample_num:
break
rec = {
'im_id': np.array([ct]),
"img_path": os.path.abspath(image),
"img_name": os.path.basename(image),
"lanes": []
}
self._imid2path[ct] = image
ct += 1
records.append(rec)
assert len(records) > 0, "No image file found"
return records
def get_imid2path(self):
return self._imid2path
def __getitem__(self, idx):
data_info = self.data_infos[idx]
img = cv2.imread(data_info['img_path'])
img = img[self.cut_height:, :, :]
sample = data_info.copy()
sample.update({'image': img})
img_org = sample['image']
if self.training:
label = cv2.imread(sample['mask_path'], cv2.IMREAD_UNCHANGED)
if len(label.shape) > 2:
label = label[:, :, 0]
label = label.squeeze()
label = label[self.cut_height:, :]
sample.update({'mask': label})
if self.cut_height != 0:
new_lanes = []
for i in sample['lanes']:
lanes = []
for p in i:
lanes.append((p[0], p[1] - self.cut_height))
new_lanes.append(lanes)
sample.update({'lanes': new_lanes})
sample['mask'] = SegmentationMapsOnImage(
sample['mask'], shape=img_org.shape)
sample['full_img_path'] = data_info['img_path']
sample['img_name'] = data_info['img_name']
sample['im_id'] = np.array([idx])
sample['image'] = sample['image'].copy().astype(np.uint8)
sample['lanes'] = lane_to_linestrings(sample['lanes'])
sample['lanes'] = LineStringsOnImage(
sample['lanes'], shape=img_org.shape)
sample['seg'] = np.zeros(img_org.shape)
return sample
================================================
FILE: ppdet/data/source/dataset.py
================================================
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import copy
import numpy as np
try:
from collections.abc import Sequence
except Exception:
from collections import Sequence
from pycocotools.coco import COCO
from paddle.io import Dataset
from ppdet.core.workspace import register, serializable
from ppdet.utils.download import get_dataset_path
from ppdet.data import source
from ppdet.utils.logger import setup_logger
logger = setup_logger(__name__)
@serializable
class DetDataset(Dataset):
"""
Load detection dataset.
Args:
dataset_dir (str): root directory for dataset.
image_dir (str): directory for images.
anno_path (str): annotation file path.
data_fields (list): key name of data dictionary, at least have 'image'.
sample_num (int): number of samples to load, -1 means all.
use_default_label (bool): whether to load default label list.
repeat (int): repeat times for dataset, use in benchmark.
"""
def __init__(self,
dataset_dir=None,
image_dir=None,
anno_path=None,
data_fields=['image'],
sample_num=-1,
use_default_label=None,
repeat=1,
**kwargs):
super(DetDataset, self).__init__()
self.dataset_dir = dataset_dir if dataset_dir is not None else ''
self.anno_path = anno_path
self.image_dir = image_dir if image_dir is not None else ''
self.data_fields = data_fields
self.sample_num = sample_num
self.use_default_label = use_default_label
self.repeat = repeat
self._epoch = 0
self._curr_iter = 0
def __len__(self, ):
return len(self.roidbs) * self.repeat
def __call__(self, *args, **kwargs):
return self
def __getitem__(self, idx):
n = len(self.roidbs)
if self.repeat > 1:
idx %= n
# data batch
roidb = copy.deepcopy(self.roidbs[idx])
if self.mixup_epoch == 0 or self._epoch < self.mixup_epoch:
idx = np.random.randint(n)
roidb = [roidb, copy.deepcopy(self.roidbs[idx])]
elif self.cutmix_epoch == 0 or self._epoch < self.cutmix_epoch:
idx = np.random.randint(n)
roidb = [roidb, copy.deepcopy(self.roidbs[idx])]
elif self.mosaic_epoch == 0 or self._epoch < self.mosaic_epoch:
roidb = [roidb, ] + [
copy.deepcopy(self.roidbs[np.random.randint(n)])
for _ in range(4)
]
elif self.pre_img_epoch == 0 or self._epoch < self.pre_img_epoch:
# Add previous image as input, only used in CenterTrack
idx_pre_img = idx - 1
if idx_pre_img < 0:
idx_pre_img = idx + 1
roidb = [roidb, ] + [copy.deepcopy(self.roidbs[idx_pre_img])]
if isinstance(roidb, Sequence):
for r in roidb:
r['curr_iter'] = self._curr_iter
r['curr_epoch'] = self._epoch
else:
roidb['curr_iter'] = self._curr_iter
roidb['curr_epoch'] = self._epoch
self._curr_iter += 1
if self.transform_schedulers:
asse
gitextract_swotw2om/
├── .gitignore
├── LICENSE
├── README.md
├── configs/
│ ├── datasets/
│ │ ├── coco_detection.yml
│ │ ├── coco_instance.yml
│ │ ├── culane.yml
│ │ ├── dota.yml
│ │ ├── dota_ms.yml
│ │ ├── lvis_detection.yml
│ │ ├── mcmot.yml
│ │ ├── mot.yml
│ │ ├── objects365_detection.yml
│ │ ├── roadsign_voc.yml
│ │ ├── sniper_coco_detection.yml
│ │ ├── sniper_visdrone_detection.yml
│ │ ├── spine_coco.yml
│ │ ├── visdrone_detection.yml
│ │ ├── voc.yml
│ │ └── wider_face.yml
│ ├── rtdetrv3/
│ │ ├── _base_/
│ │ │ ├── optimizer_6x.yml
│ │ │ ├── rtdetr_reader.yml
│ │ │ └── rtdetrv3_r50vd.yml
│ │ ├── rtdetrv3_r18vd_6x_coco.yml
│ │ ├── rtdetrv3_r18vd_6x_lvis.yml
│ │ ├── rtdetrv3_r34vd_6x_coco.yml
│ │ ├── rtdetrv3_r50vd_6x_coco.yml
│ │ └── rtdetrv3_r50vd_6x_lvis.yml
│ └── runtime.yml
├── dataset/
│ ├── coco/
│ │ └── download_coco.py
│ ├── dota/
│ │ └── .gitignore
│ ├── mot/
│ │ └── gen_labels_MOT.py
│ ├── roadsign_voc/
│ │ ├── download_roadsign_voc.py
│ │ └── label_list.txt
│ ├── spine_coco/
│ │ └── download_spine_coco.py
│ ├── voc/
│ │ ├── create_list.py
│ │ ├── download_voc.py
│ │ └── label_list.txt
│ └── wider_face/
│ └── download_wider_face.sh
├── ppdet/
│ ├── __init__.py
│ ├── core/
│ │ ├── __init__.py
│ │ ├── config/
│ │ │ ├── __init__.py
│ │ │ ├── schema.py
│ │ │ └── yaml_helpers.py
│ │ └── workspace.py
│ ├── data/
│ │ ├── __init__.py
│ │ ├── crop_utils/
│ │ │ ├── __init__.py
│ │ │ ├── annotation_cropper.py
│ │ │ └── chip_box_utils.py
│ │ ├── culane_utils.py
│ │ ├── reader.py
│ │ ├── shm_utils.py
│ │ ├── source/
│ │ │ ├── __init__.py
│ │ │ ├── category.py
│ │ │ ├── coco.py
│ │ │ ├── culane.py
│ │ │ ├── dataset.py
│ │ │ ├── keypoint_coco.py
│ │ │ ├── lvis.py
│ │ │ ├── mot.py
│ │ │ ├── pose3d_cmb.py
│ │ │ ├── sniper_coco.py
│ │ │ ├── voc.py
│ │ │ └── widerface.py
│ │ ├── transform/
│ │ │ ├── __init__.py
│ │ │ ├── atss_assigner.py
│ │ │ ├── autoaugment_utils.py
│ │ │ ├── batch_operators.py
│ │ │ ├── culane_operators.py
│ │ │ ├── gridmask_utils.py
│ │ │ ├── keypoint_operators.py
│ │ │ ├── keypoints_3d_operators.py
│ │ │ ├── mot_operators.py
│ │ │ ├── op_helper.py
│ │ │ ├── operators.py
│ │ │ └── rotated_operators.py
│ │ └── utils.py
│ ├── engine/
│ │ ├── __init__.py
│ │ ├── callbacks.py
│ │ ├── env.py
│ │ ├── export_utils.py
│ │ ├── naive_sync_bn.py
│ │ ├── tracker.py
│ │ ├── trainer.py
│ │ ├── trainer_cot.py
│ │ └── trainer_ssod.py
│ ├── ext_op/
│ │ ├── README.md
│ │ ├── csrc/
│ │ │ ├── matched_rbox_iou/
│ │ │ │ ├── matched_rbox_iou.cc
│ │ │ │ └── matched_rbox_iou.cu
│ │ │ ├── nms_rotated/
│ │ │ │ ├── nms_rotated.cc
│ │ │ │ └── nms_rotated.cu
│ │ │ └── rbox_iou/
│ │ │ ├── rbox_iou.cc
│ │ │ ├── rbox_iou.cu
│ │ │ └── rbox_iou_utils.h
│ │ ├── setup.py
│ │ └── unittest/
│ │ ├── test_matched_rbox_iou.py
│ │ └── test_rbox_iou.py
│ ├── metrics/
│ │ ├── __init__.py
│ │ ├── coco_utils.py
│ │ ├── culane_metrics.py
│ │ ├── fast_cocoeval/
│ │ │ ├── README.md
│ │ │ ├── __init__.py
│ │ │ ├── ext/
│ │ │ │ ├── cocoeval.cc
│ │ │ │ ├── cocoeval.h
│ │ │ │ └── setup.py
│ │ │ └── fast_cocoeval.py
│ │ ├── json_results.py
│ │ ├── keypoint_metrics.py
│ │ ├── lvis_utils.py
│ │ ├── map_utils.py
│ │ ├── mcmot_metrics.py
│ │ ├── metrics.py
│ │ ├── mot_metrics.py
│ │ ├── munkres.py
│ │ ├── pose3d_metrics.py
│ │ └── widerface_utils.py
│ ├── model_zoo/
│ │ ├── .gitignore
│ │ ├── __init__.py
│ │ ├── model_zoo.py
│ │ └── tests/
│ │ ├── __init__.py
│ │ ├── test_get_model.py
│ │ └── test_list_model.py
│ ├── modeling/
│ │ ├── __init__.py
│ │ ├── architectures/
│ │ │ ├── __init__.py
│ │ │ ├── blazeface.py
│ │ │ ├── bytetrack.py
│ │ │ ├── cascade_rcnn.py
│ │ │ ├── centernet.py
│ │ │ ├── centertrack.py
│ │ │ ├── clrnet.py
│ │ │ ├── deepsort.py
│ │ │ ├── detr.py
│ │ │ ├── detr_ssod.py
│ │ │ ├── fairmot.py
│ │ │ ├── faster_rcnn.py
│ │ │ ├── fcos.py
│ │ │ ├── gfl.py
│ │ │ ├── jde.py
│ │ │ ├── keypoint_hrhrnet.py
│ │ │ ├── keypoint_hrnet.py
│ │ │ ├── keypoint_petr.py
│ │ │ ├── keypoint_vitpose.py
│ │ │ ├── mask_rcnn.py
│ │ │ ├── meta_arch.py
│ │ │ ├── multi_stream_detector.py
│ │ │ ├── picodet.py
│ │ │ ├── pose3d_metro.py
│ │ │ ├── ppyoloe.py
│ │ │ ├── queryinst.py
│ │ │ ├── retinanet.py
│ │ │ ├── rtdetrv3.py
│ │ │ ├── s2anet.py
│ │ │ ├── solov2.py
│ │ │ ├── sparse_rcnn.py
│ │ │ ├── ssd.py
│ │ │ ├── tood.py
│ │ │ ├── ttfnet.py
│ │ │ ├── yolo.py
│ │ │ ├── yolof.py
│ │ │ └── yolox.py
│ │ ├── assigners/
│ │ │ ├── __init__.py
│ │ │ ├── atss_assigner.py
│ │ │ ├── clrnet_assigner.py
│ │ │ ├── fcosr_assigner.py
│ │ │ ├── hungarian_assigner.py
│ │ │ ├── max_iou_assigner.py
│ │ │ ├── pose_utils.py
│ │ │ ├── rotated_task_aligned_assigner.py
│ │ │ ├── simota_assigner.py
│ │ │ ├── task_aligned_assigner.py
│ │ │ ├── task_aligned_assigner_cr.py
│ │ │ ├── uniform_assigner.py
│ │ │ └── utils.py
│ │ ├── backbones/
│ │ │ ├── __init__.py
│ │ │ ├── blazenet.py
│ │ │ ├── clrnet_resnet.py
│ │ │ ├── convnext.py
│ │ │ ├── csp_darknet.py
│ │ │ ├── cspresnet.py
│ │ │ ├── darknet.py
│ │ │ ├── dla.py
│ │ │ ├── esnet.py
│ │ │ ├── focalnet.py
│ │ │ ├── ghostnet.py
│ │ │ ├── hardnet.py
│ │ │ ├── hgnet_v2.py
│ │ │ ├── hrnet.py
│ │ │ ├── lcnet.py
│ │ │ ├── lite_hrnet.py
│ │ │ ├── mobilenet_v1.py
│ │ │ ├── mobilenet_v3.py
│ │ │ ├── mobileone.py
│ │ │ ├── name_adapter.py
│ │ │ ├── res2net.py
│ │ │ ├── resnet.py
│ │ │ ├── senet.py
│ │ │ ├── shufflenet_v2.py
│ │ │ ├── swin_transformer.py
│ │ │ ├── trans_encoder.py
│ │ │ ├── transformer_utils.py
│ │ │ ├── vgg.py
│ │ │ ├── vision_transformer.py
│ │ │ ├── vit_mae.py
│ │ │ └── vitpose.py
│ │ ├── bbox_utils.py
│ │ ├── clrnet_utils.py
│ │ ├── cls_utils.py
│ │ ├── heads/
│ │ │ ├── __init__.py
│ │ │ ├── bbox_head.py
│ │ │ ├── cascade_head.py
│ │ │ ├── centernet_head.py
│ │ │ ├── centertrack_head.py
│ │ │ ├── clrnet_head.py
│ │ │ ├── detr_head.py
│ │ │ ├── face_head.py
│ │ │ ├── fcos_head.py
│ │ │ ├── fcosr_head.py
│ │ │ ├── gfl_head.py
│ │ │ ├── keypoint_hrhrnet_head.py
│ │ │ ├── mask_head.py
│ │ │ ├── petr_head.py
│ │ │ ├── pico_head.py
│ │ │ ├── ppyoloe_contrast_head.py
│ │ │ ├── ppyoloe_head.py
│ │ │ ├── ppyoloe_ins_head.py
│ │ │ ├── ppyoloe_r_head.py
│ │ │ ├── retina_head.py
│ │ │ ├── roi_extractor.py
│ │ │ ├── s2anet_head.py
│ │ │ ├── simota_head.py
│ │ │ ├── solov2_head.py
│ │ │ ├── sparse_roi_head.py
│ │ │ ├── sparsercnn_head.py
│ │ │ ├── ssd_head.py
│ │ │ ├── tood_head.py
│ │ │ ├── ttf_head.py
│ │ │ ├── vitpose_head.py
│ │ │ ├── yolo_head.py
│ │ │ └── yolof_head.py
│ │ ├── initializer.py
│ │ ├── keypoint_utils.py
│ │ ├── lane_utils.py
│ │ ├── layers.py
│ │ ├── losses/
│ │ │ ├── __init__.py
│ │ │ ├── clrnet_line_iou_loss.py
│ │ │ ├── clrnet_loss.py
│ │ │ ├── cot_loss.py
│ │ │ ├── ctfocal_loss.py
│ │ │ ├── detr_loss.py
│ │ │ ├── fairmot_loss.py
│ │ │ ├── fcos_loss.py
│ │ │ ├── focal_loss.py
│ │ │ ├── gfocal_loss.py
│ │ │ ├── iou_aware_loss.py
│ │ │ ├── iou_loss.py
│ │ │ ├── jde_loss.py
│ │ │ ├── keypoint_loss.py
│ │ │ ├── pose3d_loss.py
│ │ │ ├── probiou_loss.py
│ │ │ ├── queryinst_loss.py
│ │ │ ├── smooth_l1_loss.py
│ │ │ ├── solov2_loss.py
│ │ │ ├── sparsercnn_loss.py
│ │ │ ├── ssd_loss.py
│ │ │ ├── supcontrast.py
│ │ │ ├── varifocal_loss.py
│ │ │ └── yolo_loss.py
│ │ ├── mot/
│ │ │ ├── __init__.py
│ │ │ ├── matching/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── deepsort_matching.py
│ │ │ │ ├── jde_matching.py
│ │ │ │ └── ocsort_matching.py
│ │ │ ├── motion/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── gmc.py
│ │ │ │ ├── kalman_filter.py
│ │ │ │ └── ocsort_kalman_filter.py
│ │ │ ├── tracker/
│ │ │ │ ├── __init__.py
│ │ │ │ ├── base_jde_tracker.py
│ │ │ │ ├── base_sde_tracker.py
│ │ │ │ ├── botsort_tracker.py
│ │ │ │ ├── center_tracker.py
│ │ │ │ ├── deepsort_tracker.py
│ │ │ │ ├── jde_tracker.py
│ │ │ │ └── ocsort_tracker.py
│ │ │ ├── utils.py
│ │ │ └── visualization.py
│ │ ├── necks/
│ │ │ ├── __init__.py
│ │ │ ├── bifpn.py
│ │ │ ├── blazeface_fpn.py
│ │ │ ├── centernet_fpn.py
│ │ │ ├── channel_mapper.py
│ │ │ ├── clrnet_fpn.py
│ │ │ ├── csp_pan.py
│ │ │ ├── custom_pan.py
│ │ │ ├── dilated_encoder.py
│ │ │ ├── es_pan.py
│ │ │ ├── fpn.py
│ │ │ ├── hrfpn.py
│ │ │ ├── lc_pan.py
│ │ │ ├── ttf_fpn.py
│ │ │ └── yolo_fpn.py
│ │ ├── ops.py
│ │ ├── post_process.py
│ │ ├── proposal_generator/
│ │ │ ├── __init__.py
│ │ │ ├── anchor_generator.py
│ │ │ ├── embedding_rpn_head.py
│ │ │ ├── proposal_generator.py
│ │ │ ├── rpn_head.py
│ │ │ ├── target.py
│ │ │ └── target_layer.py
│ │ ├── rbox_utils.py
│ │ ├── reid/
│ │ │ ├── __init__.py
│ │ │ ├── fairmot_embedding_head.py
│ │ │ ├── jde_embedding_head.py
│ │ │ ├── pplcnet_embedding.py
│ │ │ ├── pyramidal_embedding.py
│ │ │ ├── resnet.py
│ │ │ └── resnet_embedding.py
│ │ ├── shape_spec.py
│ │ ├── ssod/
│ │ │ ├── __init__.py
│ │ │ ├── losses.py
│ │ │ └── utils.py
│ │ ├── tests/
│ │ │ ├── __init__.py
│ │ │ ├── test_architectures.py
│ │ │ ├── test_base.py
│ │ │ ├── test_mstest.py
│ │ │ ├── test_ops.py
│ │ │ └── test_yolov3_loss.py
│ │ └── transformers/
│ │ ├── __init__.py
│ │ ├── deformable_transformer.py
│ │ ├── detr_transformer.py
│ │ ├── dino_transformer.py
│ │ ├── ext_op/
│ │ │ ├── README.md
│ │ │ ├── ms_deformable_attn_op.cc
│ │ │ ├── ms_deformable_attn_op.cu
│ │ │ ├── setup_ms_deformable_attn_op.py
│ │ │ └── test_ms_deformable_attn_op.py
│ │ ├── group_detr_transformer.py
│ │ ├── hybrid_encoder.py
│ │ ├── mask_dino_transformer.py
│ │ ├── mask_rtdetr_transformer.py
│ │ ├── matchers.py
│ │ ├── petr_transformer.py
│ │ ├── position_encoding.py
│ │ ├── rtdetr_transformer.py
│ │ ├── rtdetr_transformerv2.py
│ │ ├── rtdetr_transformerv3.py
│ │ └── utils.py
│ ├── optimizer/
│ │ ├── __init__.py
│ │ ├── adamw.py
│ │ ├── ema.py
│ │ ├── optimizer.py
│ │ └── utils.py
│ ├── slim/
│ │ ├── __init__.py
│ │ ├── distill_loss.py
│ │ ├── distill_model.py
│ │ ├── ofa.py
│ │ ├── prune.py
│ │ ├── quant.py
│ │ └── unstructured_prune.py
│ └── utils/
│ ├── __init__.py
│ ├── cam_utils.py
│ ├── check.py
│ ├── checkpoint.py
│ ├── cli.py
│ ├── colormap.py
│ ├── compact.py
│ ├── download.py
│ ├── fuse_utils.py
│ ├── logger.py
│ ├── profiler.py
│ ├── stats.py
│ ├── visualizer.py
│ └── voc_utils.py
├── requirements.txt
├── scripts/
│ ├── build_wheel.sh
│ ├── eval.sh
│ ├── kill.sh
│ └── train.sh
└── tools/
├── anchor_cluster.py
├── box_distribution.py
├── cam_ppdet.py
├── eval.py
├── eval_mot.py
├── export_model.py
├── gen_semi_coco.py
├── infer.py
├── infer_culane.py
├── infer_mot.py
├── post_quant.py
├── slice_image.py
├── sniper_params_stats.py
├── train.py
└── x2coco.py
Showing preview only (315K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (4298 symbols across 311 files)
FILE: dataset/mot/gen_labels_MOT.py
function mkdirs (line 25) | def mkdirs(d):
FILE: ppdet/core/config/schema.py
function doc_parse (line 27) | def doc_parse(*args):
function check_type (line 35) | def check_type(*args):
class SchemaValue (line 42) | class SchemaValue(object):
method __init__ (line 43) | def __init__(self, name, doc='', type=None):
method set_default (line 49) | def set_default(self, value):
method has_default (line 52) | def has_default(self):
class SchemaDict (line 56) | class SchemaDict(dict):
method __init__ (line 57) | def __init__(self, **kwargs):
method __setitem__ (line 64) | def __setitem__(self, key, value):
method __missing__ (line 72) | def __missing__(self, key):
method copy (line 80) | def copy(self):
method set_schema (line 86) | def set_schema(self, key, value):
method set_strict (line 90) | def set_strict(self, strict):
method has_default (line 93) | def has_default(self, key):
method is_default (line 96) | def is_default(self, key):
method find_default_keys (line 104) | def find_default_keys(self):
method mandatory (line 110) | def mandatory(self):
method find_missing_keys (line 113) | def find_missing_keys(self):
method find_extra_keys (line 121) | def find_extra_keys(self):
method find_mismatch_keys (line 124) | def find_mismatch_keys(self):
method validate (line 135) | def validate(self):
class SharedConfig (line 150) | class SharedConfig(object):
method __init__ (line 165) | def __init__(self, key, default_value=None):
function extract_schema (line 171) | def extract_schema(cls):
FILE: ppdet/core/config/yaml_helpers.py
function represent_dictionary_order (line 24) | def represent_dictionary_order(self, dict_data):
function setup_orderdict (line 28) | def setup_orderdict():
function _make_python_constructor (line 33) | def _make_python_constructor(cls):
function _make_python_representer (line 50) | def _make_python_representer(cls):
function serializable (line 70) | def serializable(cls):
class Callable (line 91) | class Callable(object):
method __init__ (line 99) | def __init__(self, full_type, args=[], kwargs={}):
method __call__ (line 105) | def __call__(self):
FILE: ppdet/core/workspace.py
function dump_value (line 46) | def dump_value(value):
class AttrDict (line 58) | class AttrDict(dict):
method __init__ (line 61) | def __init__(self, **kwargs):
method __getattr__ (line 65) | def __getattr__(self, key):
method __setattr__ (line 70) | def __setattr__(self, key, value):
method copy (line 73) | def copy(self):
function _load_config_with_base (line 86) | def _load_config_with_base(file_path):
function load_config (line 110) | def load_config(file_path):
function dict_merge (line 130) | def dict_merge(dct, merge_dct):
function merge_config (line 151) | def merge_config(config, another_cfg=None):
function get_registered_modules (line 165) | def get_registered_modules():
function make_partial (line 169) | def make_partial(cls):
function register (line 192) | def register(cls):
function create (line 210) | def create(cls_or_name, **kwargs):
FILE: ppdet/data/crop_utils/annotation_cropper.py
class AnnoCropper (line 29) | class AnnoCropper(object):
method __init__ (line 30) | def __init__(self,
method crop_anno_records (line 65) | def crop_anno_records(self, records: List[dict]):
method _add_to_cur_im_chips (line 146) | def _add_to_cur_im_chips(self, chips, pos_chip2boxes_idx, neg_chip2box...
method _trans_all_chips2annotations (line 158) | def _trans_all_chips2annotations(self, r):
method _trans_pos_chips2annotations (line 177) | def _trans_pos_chips2annotations(self, im_file, gt_bbox, is_crowd,
method _sample_neg_chips (line 201) | def _sample_neg_chips(self):
method _trans_neg_chips2annotations (line 216) | def _trans_neg_chips2annotations(self,
method _get_current_scale_parameters (line 242) | def _get_current_scale_parameters(self, scale_i, r):
method _get_current_scale (line 249) | def _get_current_scale(self, im_target_size, im_size):
method _create_chips (line 252) | def _create_chips(self, h: int, w: int, scale: float):
method _get_valid_boxes_and_pos_chips (line 295) | def _get_valid_boxes_and_pos_chips(self, gt_bbox, chips):
method _validate_boxes (line 307) | def _validate_boxes(self,
method _find_pos_chips (line 331) | def _find_pos_chips(self,
method _find_chips_to_cover_overlaped_boxes (line 350) | def _find_chips_to_cover_overlaped_boxes(self, iob, overlap_threshold):
method _assign_boxes_to_pos_chips (line 353) | def _assign_boxes_to_pos_chips(self, iob, overlap_threshold, pos_chip_...
method _get_neg_boxes_and_chips (line 364) | def _get_neg_boxes_and_chips(self,
method _find_neg_boxes (line 391) | def _find_neg_boxes(self,
method _find_neg_chips (line 408) | def _find_neg_chips(self, chips: 'Cx4', pos_chip_ids: 'D',
method crop_infer_anno_records (line 428) | def crop_infer_anno_records(self, records: List[dict]):
method _get_chips_records (line 458) | def _get_chips_records(self, rec, chips, scale_i):
method aggregate_chips_detections (line 484) | def aggregate_chips_detections(self, results, records=None):
method _transform_chip2image_bboxes (line 500) | def _transform_chip2image_bboxes(self, results, records):
method _nms_dets (line 545) | def _nms_dets(self, img_id2bbox):
method _reformat_results (line 565) | def _reformat_results(self, img_id2bbox):
FILE: ppdet/data/crop_utils/chip_box_utils.py
function bbox_area (line 18) | def bbox_area(boxes):
function intersection_over_box (line 22) | def intersection_over_box(chips, boxes):
function clip_boxes (line 48) | def clip_boxes(boxes, im_shape):
function transform_chip_box (line 66) | def transform_chip_box(gt_bbox: 'Gx4', boxes_idx: 'B', chip: '4'):
function find_chips_to_cover_overlaped_boxes (line 83) | def find_chips_to_cover_overlaped_boxes(iob, overlap_threshold):
function transform_chip_boxes2image_boxes (line 105) | def transform_chip_boxes2image_boxes(chip_boxes, chip, img_h, img_w):
function nms (line 117) | def nms(dets, thresh):
FILE: ppdet/data/culane_utils.py
function lane_to_linestrings (line 7) | def lane_to_linestrings(lanes):
function linestrings_to_lanes (line 15) | def linestrings_to_lanes(lines):
function sample_lane (line 23) | def sample_lane(points, sample_ys, img_w):
function filter_lane (line 57) | def filter_lane(lane):
function transform_annotation (line 69) | def transform_annotation(img_w, img_h, max_lanes, n_offsets, offsets_ys,
FILE: ppdet/data/reader.py
class Compose (line 43) | class Compose(object):
method __init__ (line 44) | def __init__(self, transforms, num_classes=80):
method _update_transforms_cls (line 56) | def _update_transforms_cls(self, data):
method __call__ (line 76) | def __call__(self, data):
class BatchCompose (line 91) | class BatchCompose(Compose):
method __init__ (line 92) | def __init__(self, transforms, num_classes=80, collate_batch=True):
method __call__ (line 96) | def __call__(self, data):
class BaseDataLoader (line 133) | class BaseDataLoader(object):
method __init__ (line 162) | def __init__(self,
method __call__ (line 185) | def __call__(self,
method __len__ (line 230) | def __len__(self):
method __iter__ (line 233) | def __iter__(self):
method __next__ (line 236) | def __next__(self):
method next (line 243) | def next(self):
class TrainReader (line 249) | class TrainReader(BaseDataLoader):
method __init__ (line 252) | def __init__(self,
class EvalReader (line 267) | class EvalReader(BaseDataLoader):
method __init__ (line 270) | def __init__(self,
class TestReader (line 284) | class TestReader(BaseDataLoader):
method __init__ (line 287) | def __init__(self,
class EvalMOTReader (line 301) | class EvalMOTReader(BaseDataLoader):
method __init__ (line 304) | def __init__(self,
class TestMOTReader (line 318) | class TestMOTReader(BaseDataLoader):
method __init__ (line 321) | def __init__(self,
class Compose_SSOD (line 335) | class Compose_SSOD(object):
method __init__ (line 336) | def __init__(self, base_transforms, weak_aug, strong_aug, num_classes=...
method __call__ (line 367) | def __call__(self, data):
class BatchCompose_SSOD (line 404) | class BatchCompose_SSOD(Compose):
method __init__ (line 405) | def __init__(self, transforms, num_classes=80, collate_batch=True):
method __call__ (line 409) | def __call__(self, data):
class CombineSSODLoader (line 469) | class CombineSSODLoader(object):
method __init__ (line 470) | def __init__(self, label_loader, unlabel_loader):
method __iter__ (line 474) | def __iter__(self):
method __call__ (line 495) | def __call__(self):
class BaseSemiDataLoader (line 499) | class BaseSemiDataLoader(object):
method __init__ (line 500) | def __init__(self,
method __call__ (line 534) | def __call__(self,
method __len__ (line 605) | def __len__(self):
method __iter__ (line 608) | def __iter__(self):
method __next__ (line 611) | def __next__(self):
method next (line 614) | def next(self):
class SemiTrainReader (line 620) | class SemiTrainReader(BaseSemiDataLoader):
method __init__ (line 623) | def __init__(self,
FILE: ppdet/data/shm_utils.py
function _parse_size_in_M (line 36) | def _parse_size_in_M(size_str):
function _get_shared_memory_size_in_M (line 47) | def _get_shared_memory_size_in_M():
FILE: ppdet/data/source/category.py
function get_categories (line 29) | def get_categories(metric_type, anno_file=None, arch=None):
function _mot_category (line 169) | def _mot_category(category='pedestrian'):
function _coco17_category (line 184) | def _coco17_category():
function _dota_category (line 363) | def _dota_category():
function _vocall_category (line 391) | def _vocall_category():
function _widerface_category (line 407) | def _widerface_category():
function _oid19_category (line 417) | def _oid19_category():
function _visdrone_category (line 927) | def _visdrone_category():
FILE: ppdet/data/source/coco.py
class COCODataSet (line 37) | class COCODataSet(DetDataset):
method __init__ (line 56) | def __init__(self,
method _sample_empty (line 79) | def _sample_empty(self, records, num):
method parse_dataset (line 89) | def parse_dataset(self):
class SlicedCOCODataSet (line 256) | class SlicedCOCODataSet(COCODataSet):
method __init__ (line 259) | def __init__(
method parse_dataset (line 285) | def parse_dataset(self):
class SemiCOCODataSet (line 379) | class SemiCOCODataSet(COCODataSet):
method __init__ (line 382) | def __init__(self,
method parse_dataset (line 399) | def parse_dataset(self):
method __getitem__ (line 567) | def __getitem__(self, idx):
class COCODetDataset (line 597) | class COCODetDataset(COCODataSet):
class COCOInstSegDataset (line 604) | class COCOInstSegDataset(COCODataSet):
FILE: ppdet/data/source/culane.py
class CULaneDataSet (line 25) | class CULaneDataSet(DetDataset):
method __init__ (line 26) | def __init__(
method __len__ (line 52) | def __len__(self):
method check_or_download_dataset (line 55) | def check_or_download_dataset(self):
method parse_dataset (line 69) | def parse_dataset(self):
method load_annotation (line 93) | def load_annotation(self, line):
method set_images (line 128) | def set_images(self, images):
method _find_images (line 132) | def _find_images(self):
method _load_images (line 145) | def _load_images(self):
method get_imid2path (line 166) | def get_imid2path(self):
method __getitem__ (line 169) | def __getitem__(self, idx):
FILE: ppdet/data/source/dataset.py
class DetDataset (line 33) | class DetDataset(Dataset):
method __init__ (line 47) | def __init__(self,
method __len__ (line 67) | def __len__(self, ):
method __call__ (line 70) | def __call__(self, *args, **kwargs):
method __getitem__ (line 73) | def __getitem__(self, idx):
method check_or_download_dataset (line 115) | def check_or_download_dataset(self):
method set_kwargs (line 119) | def set_kwargs(self, **kwargs):
method set_transform (line 126) | def set_transform(self, transform):
method set_epoch (line 129) | def set_epoch(self, epoch_id):
method parse_dataset (line 132) | def parse_dataset(self, ):
method get_anno (line 136) | def get_anno(self):
function _is_valid_file (line 142) | def _is_valid_file(f, extensions=('.jpg', '.jpeg', '.png', '.bmp')):
function _make_dataset (line 146) | def _make_dataset(dir):
class ImageFolder (line 161) | class ImageFolder(DetDataset):
method __init__ (line 162) | def __init__(self,
method check_or_download_dataset (line 179) | def check_or_download_dataset(self):
method get_anno (line 182) | def get_anno(self):
method parse_dataset (line 190) | def parse_dataset(self, ):
method _parse (line 194) | def _parse(self):
method get_images (line 207) | def get_images(self):
method _load_images (line 216) | def _load_images(self, do_eval=False):
method get_image_id (line 237) | def get_image_id(self, image, coco):
method get_imid2path (line 246) | def get_imid2path(self):
method set_images (line 249) | def set_images(self, images, do_eval=False):
method set_slice_images (line 253) | def set_slice_images(self,
method get_label_list (line 303) | def get_label_list(self):
class CommonDataset (line 309) | class CommonDataset(object):
method __init__ (line 310) | def __init__(self, **dataset_args):
method __call__ (line 316) | def __call__(self):
class TrainDataset (line 321) | class TrainDataset(CommonDataset):
class EvalMOTDataset (line 326) | class EvalMOTDataset(CommonDataset):
class TestMOTDataset (line 331) | class TestMOTDataset(CommonDataset):
class EvalDataset (line 336) | class EvalDataset(CommonDataset):
class TestDataset (line 341) | class TestDataset(CommonDataset):
FILE: ppdet/data/source/keypoint_coco.py
class KeypointBottomUpBaseDataset (line 29) | class KeypointBottomUpBaseDataset(DetDataset):
method __init__ (line 48) | def __init__(self,
method parse_dataset (line 67) | def parse_dataset(self):
method __len__ (line 70) | def __len__(self):
method _get_imganno (line 74) | def _get_imganno(self, idx):
method __getitem__ (line 78) | def __getitem__(self, idx):
method parse_dataset (line 88) | def parse_dataset(self):
class KeypointBottomUpCocoDataset (line 94) | class KeypointBottomUpCocoDataset(KeypointBottomUpBaseDataset):
method __init__ (line 132) | def __init__(self,
method parse_dataset (line 155) | def parse_dataset(self):
method _get_mapping_id_name (line 182) | def _get_mapping_id_name(imgs):
method _get_imganno (line 202) | def _get_imganno(self, idx):
method _get_joints (line 244) | def _get_joints(self, anno, idx):
method _get_bboxs (line 260) | def _get_bboxs(self, anno, idx):
method _get_labels (line 272) | def _get_labels(self, anno, idx):
method _get_areas (line 282) | def _get_areas(self, anno, idx):
method _get_mask (line 291) | def _get_mask(self, anno, idx):
class KeypointBottomUpCrowdPoseDataset (line 317) | class KeypointBottomUpCrowdPoseDataset(KeypointBottomUpCocoDataset):
method __init__ (line 352) | def __init__(self,
method parse_dataset (line 367) | def parse_dataset(self):
class KeypointTopDownBaseDataset (line 388) | class KeypointTopDownBaseDataset(DetDataset):
method __init__ (line 403) | def __init__(self,
method __len__ (line 419) | def __len__(self):
method _get_db (line 423) | def _get_db(self):
method __getitem__ (line 427) | def __getitem__(self, idx):
class KeypointTopDownCocoDataset (line 441) | class KeypointTopDownCocoDataset(KeypointTopDownBaseDataset):
method __init__ (line 484) | def __init__(self,
method parse_dataset (line 507) | def parse_dataset(self):
method _load_coco_keypoint_annotations (line 513) | def _load_coco_keypoint_annotations(self):
method _box2cs (line 572) | def _box2cs(self, box):
method _load_coco_person_detection_results (line 594) | def _load_coco_person_detection_results(self):
class KeypointTopDownCocoWholeBodyHandDataset (line 640) | class KeypointTopDownCocoWholeBodyHandDataset(KeypointTopDownBaseDataset):
method __init__ (line 681) | def __init__(self,
method _box2cs (line 696) | def _box2cs(self, box):
method parse_dataset (line 715) | def parse_dataset(self):
class KeypointTopDownMPIIDataset (line 756) | class KeypointTopDownMPIIDataset(KeypointTopDownBaseDataset):
method __init__ (line 790) | def __init__(self,
method parse_dataset (line 801) | def parse_dataset(self):
FILE: ppdet/data/source/lvis.py
class LVISDataSet (line 36) | class LVISDataSet(DetDataset):
method __init__ (line 55) | def __init__(self,
method _sample_empty (line 78) | def _sample_empty(self, records, num):
method parse_dataset (line 88) | def parse_dataset(self):
FILE: ppdet/data/source/mot.py
class MOTDataSet (line 33) | class MOTDataSet(DetDataset):
method __init__ (line 77) | def __init__(self,
method get_anno (line 95) | def get_anno(self):
method parse_dataset (line 105) | def parse_dataset(self):
class MCMOTDataSet (line 233) | class MCMOTDataSet(DetDataset):
method __init__ (line 259) | def __init__(self,
method get_anno (line 277) | def get_anno(self):
method parse_dataset (line 287) | def parse_dataset(self):
class MOTImageFolder (line 460) | class MOTImageFolder(DetDataset):
method __init__ (line 472) | def __init__(self,
method check_or_download_dataset (line 492) | def check_or_download_dataset(self):
method parse_dataset (line 495) | def parse_dataset(self, ):
method _load_video_images (line 503) | def _load_video_images(self):
method _find_images (line 535) | def _find_images(self):
method _load_images (line 548) | def _load_images(self):
method get_imid2path (line 566) | def get_imid2path(self):
method set_images (line 569) | def set_images(self, images):
method set_video (line 573) | def set_video(self, video_file, frame_rate):
method get_anno (line 581) | def get_anno(self):
function _is_valid_video (line 585) | def _is_valid_video(f, extensions=('.mp4', '.avi', '.mov', '.rmvb', 'flv...
function video2frames (line 589) | def video2frames(video_path, outpath, frame_rate, **kargs):
function mot_label (line 620) | def mot_label():
function visdrone_mcmot_label (line 625) | def visdrone_mcmot_label():
FILE: ppdet/data/source/pose3d_cmb.py
class Pose3DDataset (line 28) | class Pose3DDataset(DetDataset):
method __init__ (line 48) | def __init__(self,
method get_mask (line 68) | def get_mask(self, mvm_percent=0.3):
method filterjoints (line 96) | def filterjoints(self, x):
method parse_dataset (line 108) | def parse_dataset(self):
method get_temp_num (line 167) | def get_temp_num(self):
method __len__ (line 171) | def __len__(self):
method _get_imganno (line 175) | def _get_imganno(self, idx):
method __getitem__ (line 179) | def __getitem__(self, idx):
method check_or_download_dataset (line 189) | def check_or_download_dataset(self):
class Keypoint3DMultiFramesDataset (line 204) | class Keypoint3DMultiFramesDataset(Dataset):
method __init__ (line 217) | def __init__(
method _generate_multi_frames_list (line 237) | def _generate_multi_frames_list(self):
method __call__ (line 263) | def __call__(self, *args, **kwargs):
method __getitem__ (line 266) | def __getitem__(self, index): # 拿一个连续的序列
method kps3d_process (line 326) | def kps3d_process(self, kps3d_path):
method __len__ (line 357) | def __len__(self):
method get_anno (line 360) | def get_anno(self):
method check_or_download_dataset (line 365) | def check_or_download_dataset(self):
method parse_dataset (line 368) | def parse_dataset(self, ):
method set_transform (line 371) | def set_transform(self, transform):
method set_epoch (line 374) | def set_epoch(self, epoch_id):
method set_kwargs (line 377) | def set_kwargs(self, **kwargs):
FILE: ppdet/data/source/sniper_coco.py
class SniperCOCODataSet (line 37) | class SniperCOCODataSet(COCODataSet):
method __init__ (line 40) | def __init__(self,
method parse_dataset (line 83) | def parse_dataset(self):
method set_proposals_file (line 93) | def set_proposals_file(self, file_path):
method init_anno_cropper (line 96) | def init_anno_cropper(self):
method generate_chips_roidbs (line 109) | def generate_chips_roidbs(self, roidbs, is_trainset):
method _parse_proposals (line 116) | def _parse_proposals(self):
method _merge_anno_proposals (line 129) | def _merge_anno_proposals(self):
method get_ori_roidbs (line 140) | def get_ori_roidbs(self):
method get_roidbs (line 145) | def get_roidbs(self):
method set_roidbs (line 150) | def set_roidbs(self, roidbs):
method check_or_download_dataset (line 153) | def check_or_download_dataset(self):
method _parse (line 156) | def _parse(self):
method _load_images (line 169) | def _load_images(self):
method get_imid2path (line 187) | def get_imid2path(self):
method set_images (line 190) | def set_images(self, images):
FILE: ppdet/data/source/voc.py
class VOCDataSet (line 30) | class VOCDataSet(DetDataset):
method __init__ (line 52) | def __init__(self,
method _sample_empty (line 73) | def _sample_empty(self, records, num):
method parse_dataset (line 83) | def parse_dataset(self, ):
method get_label_list (line 207) | def get_label_list(self):
function pascalvoc_label (line 211) | def pascalvoc_label():
FILE: ppdet/data/source/widerface.py
class WIDERFaceDataSet (line 29) | class WIDERFaceDataSet(DetDataset):
method __init__ (line 42) | def __init__(self,
method parse_dataset (line 62) | def parse_dataset(self):
method _load_file_list (line 114) | def _load_file_list(self, input_txt):
function widerface_label (line 180) | def widerface_label():
class WIDERFaceValDataset (line 187) | class WIDERFaceValDataset(WIDERFaceDataSet):
method __init__ (line 188) | def __init__(self,
method parse_dataset (line 214) | def parse_dataset(self):
method get_gt_infos (line 245) | def get_gt_infos(self):
FILE: ppdet/data/transform/atss_assigner.py
function bbox_overlaps (line 27) | def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False, eps=1e...
function topk_ (line 145) | def topk_(input, k, axis=1, largest=True):
class ATSSAssigner (line 171) | class ATSSAssigner(object):
method __init__ (line 184) | def __init__(self, topk=9):
method __call__ (line 187) | def __call__(self,
method get_vlr_region (line 302) | def get_vlr_region(self,
FILE: ppdet/data/transform/autoaugment_utils.py
function policy_v0 (line 38) | def policy_v0():
function policy_v1 (line 53) | def policy_v1():
function policy_vtest (line 83) | def policy_vtest():
function policy_v2 (line 92) | def policy_v2():
function policy_v3 (line 126) | def policy_v3():
function _equal (line 151) | def _equal(val1, val2, eps=1e-8):
function blend (line 155) | def blend(image1, image2, factor):
function cutout (line 198) | def cutout(image, pad_size, replace=0):
function solarize (line 250) | def solarize(image, threshold=128):
function solarize_add (line 257) | def solarize_add(image, addition=0, threshold=128):
function color (line 267) | def color(image, factor):
function contrast (line 275) | def contrast(img, factor):
function brightness (line 280) | def brightness(image, factor):
function posterize (line 286) | def posterize(image, bits):
function rotate (line 292) | def rotate(image, degrees, replace):
function random_shift_bbox (line 313) | def random_shift_bbox(image,
function _clip_bbox (line 433) | def _clip_bbox(min_y, min_x, max_y, max_x):
function _check_bbox_area (line 452) | def _check_bbox_area(min_y, min_x, max_y, max_x, delta=0.05):
function _scale_bbox_only_op_probability (line 486) | def _scale_bbox_only_op_probability(prob):
function _apply_bbox_augmentation (line 503) | def _apply_bbox_augmentation(image, bbox, augmentation_func, *args):
function _concat_bbox (line 558) | def _concat_bbox(bbox, bboxes):
function _apply_bbox_augmentation_wrapper (line 573) | def _apply_bbox_augmentation_wrapper(image, bbox, new_bboxes, prob,
function _apply_multi_bbox_augmentation (line 618) | def _apply_multi_bbox_augmentation(image, bboxes, prob, aug_func,
function _apply_multi_bbox_augmentation_wrapper (line 698) | def _apply_multi_bbox_augmentation_wrapper(image, bboxes, prob, aug_func,
function rotate_only_bboxes (line 710) | def rotate_only_bboxes(image, bboxes, prob, degrees, replace):
function shear_x_only_bboxes (line 718) | def shear_x_only_bboxes(image, bboxes, prob, level, replace):
function shear_y_only_bboxes (line 726) | def shear_y_only_bboxes(image, bboxes, prob, level, replace):
function translate_x_only_bboxes (line 734) | def translate_x_only_bboxes(image, bboxes, prob, pixels, replace):
function translate_y_only_bboxes (line 742) | def translate_y_only_bboxes(image, bboxes, prob, pixels, replace):
function flip_only_bboxes (line 750) | def flip_only_bboxes(image, bboxes, prob):
function solarize_only_bboxes (line 758) | def solarize_only_bboxes(image, bboxes, prob, threshold):
function equalize_only_bboxes (line 766) | def equalize_only_bboxes(image, bboxes, prob):
function cutout_only_bboxes (line 774) | def cutout_only_bboxes(image, bboxes, prob, pad_size, replace):
function _rotate_bbox (line 782) | def _rotate_bbox(bbox, image_height, image_width, degrees):
function rotate_with_bboxes (line 833) | def rotate_with_bboxes(image, bboxes, degrees, replace):
function translate_x (line 848) | def translate_x(image, pixels, replace):
function translate_y (line 855) | def translate_y(image, pixels, replace):
function _shift_bbox (line 862) | def _shift_bbox(bbox, image_height, image_width, pixels, shift_horizontal):
function translate_bbox (line 903) | def translate_bbox(image, bboxes, pixels, replace, shift_horizontal):
function shear_x (line 938) | def shear_x(image, level, replace):
function shear_y (line 949) | def shear_y(image, level, replace):
function _shear_bbox (line 960) | def _shear_bbox(bbox, image_height, image_width, level, shear_horizontal):
function shear_with_bboxes (line 1007) | def shear_with_bboxes(image, bboxes, level, replace, shear_horizontal):
function autocontrast (line 1043) | def autocontrast(image):
function sharpness (line 1082) | def sharpness(image, factor):
function equalize (line 1095) | def equalize(image):
function wrap (line 1137) | def wrap(image):
function unwrap (line 1145) | def unwrap(image, replace):
function _cutout_inside_bbox (line 1187) | def _cutout_inside_bbox(image, bbox, pad_fraction):
function bbox_cutout (line 1257) | def bbox_cutout(image, bboxes, pad_fraction, replace_with_mean):
function _randomly_negate_tensor (line 1348) | def _randomly_negate_tensor(tensor):
function _rotate_level_to_arg (line 1355) | def _rotate_level_to_arg(level):
function _shrink_level_to_arg (line 1361) | def _shrink_level_to_arg(level):
function _enhance_level_to_arg (line 1370) | def _enhance_level_to_arg(level):
function _shear_level_to_arg (line 1374) | def _shear_level_to_arg(level):
function _translate_level_to_arg (line 1381) | def _translate_level_to_arg(level, translate_const):
function _bbox_cutout_level_to_arg (line 1388) | def _bbox_cutout_level_to_arg(level, hparams):
function level_to_arg (line 1394) | def level_to_arg(hparams):
function bbox_wrapper (line 1437) | def bbox_wrapper(func):
function _parse_policy_info (line 1446) | def _parse_policy_info(name, prob, level, replace_value, augmentation_hp...
function _apply_func_with_prob (line 1471) | def _apply_func_with_prob(func, image, args, prob, bboxes):
function select_and_apply_random_policy (line 1490) | def select_and_apply_random_policy(policies, image, bboxes):
function build_and_apply_nas_policy (line 1500) | def build_and_apply_nas_policy(policies, image, bboxes, augmentation_hpa...
function distort_image_with_autoaugment (line 1554) | def distort_image_with_autoaugment(image, bboxes, augmentation_name):
FILE: ppdet/data/transform/batch_operators.py
class PadBatch (line 49) | class PadBatch(BaseOperator):
method __init__ (line 58) | def __init__(self, pad_to_stride=0):
method __call__ (line 62) | def __call__(self, samples, context=None):
class BatchRandomResize (line 110) | class BatchRandomResize(BaseOperator):
method __init__ (line 121) | def __init__(self,
method __call__ (line 147) | def __call__(self, samples, context=None):
class Gt2YoloTarget (line 164) | class Gt2YoloTarget(BaseOperator):
method __init__ (line 171) | def __init__(self,
method __call__ (line 184) | def __call__(self, samples, context=None):
class Gt2FCOSTarget (line 280) | class Gt2FCOSTarget(BaseOperator):
method __init__ (line 285) | def __init__(self,
method _compute_points (line 307) | def _compute_points(self, w, h):
method _convert_xywh2xyxy (line 328) | def _convert_xywh2xyxy(self, gt_bbox, w, h):
method _check_inside_boxes_limited (line 343) | def _check_inside_boxes_limited(self, gt_bbox, xs, ys,
method __call__ (line 379) | def __call__(self, samples, context=None):
class Gt2GFLTarget (line 488) | class Gt2GFLTarget(BaseOperator):
method __init__ (line 494) | def __init__(self,
method get_grid_cells (line 509) | def get_grid_cells(self, featmap_size, scale, stride, offset=0):
method get_sample (line 535) | def get_sample(self, assign_gt_inds, gt_bboxes):
method __call__ (line 550) | def __call__(self, samples, context=None):
class Gt2TTFTarget (line 626) | class Gt2TTFTarget(BaseOperator):
method __init__ (line 639) | def __init__(self, num_classes=80, down_ratio=4, alpha=0.54):
method __call__ (line 645) | def __call__(self, samples, context=None):
method draw_truncate_gaussian (line 705) | def draw_truncate_gaussian(self, heatmap, center, h_radius, w_radius):
class Gt2Solov2Target (line 728) | class Gt2Solov2Target(BaseOperator):
method __init__ (line 739) | def __init__(self,
method _scale_size (line 751) | def _scale_size(self, im, scale):
method __call__ (line 758) | def __call__(self, samples, context=None):
class Gt2SparseTarget (line 910) | class Gt2SparseTarget(BaseOperator):
method __init__ (line 911) | def __init__(self, use_padding_shape=False):
method __call__ (line 915) | def __call__(self, samples, context=None):
class PadMaskBatch (line 942) | class PadMaskBatch(BaseOperator):
method __init__ (line 953) | def __init__(self, pad_to_stride=0, return_pad_mask=True):
method __call__ (line 958) | def __call__(self, samples, context=None):
class Gt2CenterNetTarget (line 1003) | class Gt2CenterNetTarget(BaseOperator):
method __init__ (line 1014) | def __init__(self, num_classes=80, down_ratio=4, max_objs=128):
method __call__ (line 1020) | def __call__(self, sample, context=None):
class PadGT (line 1087) | class PadGT(BaseOperator):
method __init__ (line 1096) | def __init__(self, return_gt_mask=True, pad_img=False, minimum_gtnum=0...
method _impad (line 1103) | def _impad(self,
method checkmaxshape (line 1187) | def checkmaxshape(self, samples):
method __call__ (line 1197) | def __call__(self, samples, context=None):
class PadRGT (line 1287) | class PadRGT(BaseOperator):
method __init__ (line 1296) | def __init__(self, return_gt_mask=True):
method pad_field (line 1300) | def pad_field(self, sample, field, num_gt):
method __call__ (line 1308) | def __call__(self, samples, context=None):
class Gt2CenterTrackTarget (line 1341) | class Gt2CenterTrackTarget(BaseOperator):
method __init__ (line 1352) | def __init__(self,
method _get_pre_dets (line 1374) | def _get_pre_dets(self, input_h, input_w, trans_input_pre, gt_bbox_pre,
method __call__ (line 1425) | def __call__(self, sample, context=None):
class BatchRandomResizeForSSOD (line 1513) | class BatchRandomResizeForSSOD(BaseOperator):
method __init__ (line 1524) | def __init__(self,
method __call__ (line 1550) | def __call__(self, samples, context=None):
FILE: ppdet/data/transform/culane_operators.py
function trainTransforms (line 16) | def trainTransforms(img_h, img_w):
class CULaneTrainProcess (line 65) | class CULaneTrainProcess(BaseOperator):
method __init__ (line 66) | def __init__(self, img_w, img_h):
method apply (line 94) | def apply(self, sample, context=None):
class CULaneDataProcess (line 106) | class CULaneDataProcess(BaseOperator):
method __init__ (line 107) | def __init__(self, img_w, img_h, num_points, max_lanes):
method apply (line 119) | def apply(self, sample, context=None):
class CULaneResize (line 156) | class CULaneResize(BaseOperator):
method __init__ (line 157) | def __init__(self, img_h, img_w, prob=0.5):
method apply (line 163) | def apply(self, sample, context=None):
class HorizontalFlip (line 188) | class HorizontalFlip(BaseOperator):
method __init__ (line 189) | def __init__(self, prob=0.5):
method apply (line 193) | def apply(self, sample, context=None):
class ChannelShuffle (line 213) | class ChannelShuffle(BaseOperator):
method __init__ (line 214) | def __init__(self, prob=0.1):
method apply (line 218) | def apply(self, sample, context=None):
class MultiplyAndAddToBrightness (line 238) | class MultiplyAndAddToBrightness(BaseOperator):
method __init__ (line 239) | def __init__(self, mul=(0.85, 1.15), add=(-10, 10), prob=0.5):
method apply (line 245) | def apply(self, sample, context=None):
class AddToHueAndSaturation (line 268) | class AddToHueAndSaturation(BaseOperator):
method __init__ (line 269) | def __init__(self, value=(-10, 10), prob=0.5):
method apply (line 274) | def apply(self, sample, context=None):
class OneOfBlur (line 295) | class OneOfBlur(BaseOperator):
method __init__ (line 296) | def __init__(self, MotionBlur_k=(3, 5), MedianBlur_k=(3, 5), prob=0.5):
method apply (line 302) | def apply(self, sample, context=None):
class CULaneAffine (line 328) | class CULaneAffine(BaseOperator):
method __init__ (line 329) | def __init__(self,
method apply (line 344) | def apply(self, sample, context=None):
FILE: ppdet/data/transform/gridmask_utils.py
class Gridmask (line 26) | class Gridmask(object):
method __init__ (line 27) | def __init__(self,
method __call__ (line 47) | def __call__(self, x, curr_iter):
FILE: ppdet/data/transform/keypoint_operators.py
function register_keypointop (line 49) | def register_keypointop(cls):
class KeyPointFlip (line 54) | class KeyPointFlip(object):
method __init__ (line 69) | def __init__(self, flip_permutation, hmsize=None, flip_prob=0.5):
method _flipjoints (line 76) | def _flipjoints(self, records, sizelst):
method _flipmask (line 102) | def _flipmask(self, records, sizelst):
method _flipbbox (line 113) | def _flipbbox(self, records, sizelst):
method __call__ (line 124) | def __call__(self, records):
class RandomAffine (line 142) | class RandomAffine(object):
method __init__ (line 160) | def __init__(self,
method _get_affine_matrix_old (line 178) | def _get_affine_matrix_old(self, center, scale, res, rot=0):
method _get_affine_matrix (line 204) | def _get_affine_matrix(self, center, scale, res, rot=0):
method _affine_joints_mask (line 230) | def _affine_joints_mask(self,
method __call__ (line 265) | def __call__(self, records):
class EvalAffine (line 352) | class EvalAffine(object):
method __init__ (line 365) | def __init__(self, size, stride=64):
method __call__ (line 370) | def __call__(self, records):
class NormalizePermute (line 388) | class NormalizePermute(object):
method __init__ (line 389) | def __init__(self,
method __call__ (line 398) | def __call__(self, records):
class TagGenerate (line 414) | class TagGenerate(object):
method __init__ (line 427) | def __init__(self, num_joints, max_people=30):
method __call__ (line 432) | def __call__(self, records):
class ToHeatmaps (line 450) | class ToHeatmaps(object):
method __init__ (line 464) | def __init__(self, num_joints, hmsize, sigma=None):
method __call__ (line 478) | def __call__(self, records):
class RandomFlipHalfBodyTransform (line 511) | class RandomFlipHalfBodyTransform(object):
method __init__ (line 531) | def __init__(self,
method halfbody_transform (line 555) | def halfbody_transform(self, joints, joints_vis):
method flip_joints (line 588) | def flip_joints(self, joints, joints_vis, width, matched_parts):
method __call__ (line 598) | def __call__(self, records):
class AugmentationbyInformantionDropping (line 633) | class AugmentationbyInformantionDropping(object):
method __init__ (line 648) | def __init__(self,
method _cutout (line 658) | def _cutout(self, img, joints, joints_vis):
method __call__ (line 681) | def __call__(self, records):
class TopDownRandomFlip (line 692) | class TopDownRandomFlip(object):
method __init__ (line 701) | def __init__(self, flip_perm=[], flip_prob=0.5):
method flip_joints (line 705) | def flip_joints(self, joints_3d, joints_3d_visible, img_width, flip_pa...
method __call__ (line 726) | def __call__(self, results):
class TopDownRandomShiftBboxCenter (line 762) | class TopDownRandomShiftBboxCenter(object):
method __init__ (line 771) | def __init__(self, shift_factor=0.16, shift_prob=0.3):
method __call__ (line 775) | def __call__(self, results):
class TopDownGetRandomScaleRotation (line 786) | class TopDownGetRandomScaleRotation(object):
method __init__ (line 795) | def __init__(self, rot_factor=40, scale_factor=0.5, rot_prob=0.6):
method __call__ (line 800) | def __call__(self, results):
class TopDownAffine (line 820) | class TopDownAffine(object):
method __init__ (line 833) | def __init__(self, trainsize, use_udp=False):
method __call__ (line 837) | def __call__(self, records):
class SinglePoseAffine (line 870) | class SinglePoseAffine(object):
method __init__ (line 883) | def __init__(self,
method __call__ (line 895) | def __call__(self, records):
class NoiseJitter (line 957) | class NoiseJitter(object):
method __init__ (line 968) | def __init__(self, noise_factor=0.4):
method __call__ (line 971) | def __call__(self, records):
class FlipPose (line 986) | class FlipPose(object):
method __init__ (line 997) | def __init__(self, flip_prob=0.5, img_res=224, num_joints=14):
method __call__ (line 1010) | def __call__(self, records):
class TopDownEvalAffine (line 1033) | class TopDownEvalAffine(object):
method __init__ (line 1046) | def __init__(self, trainsize, use_udp=False):
method __call__ (line 1050) | def __call__(self, records):
class ToHeatmapsTopDown (line 1077) | class ToHeatmapsTopDown(object):
method __init__ (line 1090) | def __init__(self, hmsize, sigma):
method __call__ (line 1095) | def __call__(self, records):
class ToHeatmapsTopDown_DARK (line 1149) | class ToHeatmapsTopDown_DARK(object):
method __init__ (line 1162) | def __init__(self, hmsize, sigma):
method __call__ (line 1167) | def __call__(self, records):
class ToHeatmapsTopDown_UDP (line 1207) | class ToHeatmapsTopDown_UDP(object):
method __init__ (line 1224) | def __init__(self, hmsize, sigma):
method __call__ (line 1229) | def __call__(self, records):
function _scale_size (line 1284) | def _scale_size(
function rescale_size (line 1302) | def rescale_size(old_size: tuple,
function imrescale (line 1341) | def imrescale(img: np.ndarray,
function imresize (line 1373) | def imresize(
class PETR_Resize (line 1422) | class PETR_Resize:
method __init__ (line 1467) | def __init__(self,
method random_select (line 1504) | def random_select(img_scales):
method random_sample (line 1522) | def random_sample(img_scales):
method random_sample_ratio (line 1547) | def random_sample_ratio(img_scale, ratio_range):
method _random_scale (line 1573) | def _random_scale(self, results):
method _resize_img (line 1605) | def _resize_img(self, results):
method _resize_bboxes (line 1639) | def _resize_bboxes(self, results):
method _resize_masks (line 1649) | def _resize_masks(self, results):
method _resize_seg (line 1659) | def _resize_seg(self, results):
method _resize_keypoints (line 1676) | def _resize_keypoints(self, results):
method _resize_areas (line 1688) | def _resize_areas(self, results):
method __call__ (line 1696) | def __call__(self, results):
method __repr__ (line 1734) | def __repr__(self):
FILE: ppdet/data/transform/keypoints_3d_operators.py
function register_keypointop (line 45) | def register_keypointop(cls):
function register_op (line 49) | def register_op(cls):
class BaseOperator (line 58) | class BaseOperator(object):
method __init__ (line 59) | def __init__(self, name=None):
method apply (line 64) | def apply(self, sample, context=None):
method __call__ (line 74) | def __call__(self, sample, context=None):
method __str__ (line 90) | def __str__(self):
class CropAndFlipImages (line 95) | class CropAndFlipImages(object):
method __init__ (line 98) | def __init__(self, crop_range, flip_pairs=None):
method __call__ (line 103) | def __call__(self, records): # tuple
class PermuteImages (line 126) | class PermuteImages(BaseOperator):
method __init__ (line 127) | def __init__(self):
method apply (line 133) | def apply(self, sample, context=None):
class RandomFlipHalfBody3DTransformImages (line 143) | class RandomFlipHalfBody3DTransformImages(object):
method __init__ (line 160) | def __init__(self,
method halfbody_transform (line 186) | def halfbody_transform(self, joints, joints_vis):
method flip_joints (line 219) | def flip_joints(self, joints, joints_vis, width, matched_parts, kps2d=...
method __call__ (line 242) | def __call__(self, records):
FILE: ppdet/data/transform/mot_operators.py
class RGBReverse (line 45) | class RGBReverse(BaseOperator):
method __init__ (line 49) | def __init__(self):
method apply (line 52) | def apply(self, sample, context=None):
class LetterBoxResize (line 59) | class LetterBoxResize(BaseOperator):
method __init__ (line 60) | def __init__(self, target_size):
method apply_image (line 76) | def apply_image(self, img, height, width, color=(127.5, 127.5, 127.5)):
method apply_bbox (line 96) | def apply_bbox(self, bbox0, h, w, ratio, padw, padh):
method apply (line 104) | def apply(self, sample, context=None):
class MOTRandomAffine (line 134) | class MOTRandomAffine(BaseOperator):
method __init__ (line 153) | def __init__(self,
method apply (line 168) | def apply(self, sample, context=None):
class Gt2JDETargetThres (line 266) | class Gt2JDETargetThres(BaseOperator):
method __init__ (line 280) | def __init__(self,
method generate_anchor (line 297) | def generate_anchor(self, nGh, nGw, anchor_hw):
method encode_delta (line 312) | def encode_delta(self, gt_box_list, fg_anchor_list):
method pad_box (line 323) | def pad_box(self, sample, num_max):
method __call__ (line 353) | def __call__(self, samples, context=None):
class Gt2JDETargetMax (line 428) | class Gt2JDETargetMax(BaseOperator):
method __init__ (line 440) | def __init__(self,
method __call__ (line 453) | def __call__(self, samples, context=None):
class Gt2FairMOTTarget (line 526) | class Gt2FairMOTTarget(Gt2TTFTarget):
method __init__ (line 540) | def __init__(self, num_classes=1, down_ratio=4, max_objs=500):
method __call__ (line 546) | def __call__(self, samples, context=None):
FILE: ppdet/data/transform/op_helper.py
function meet_emit_constraint (line 26) | def meet_emit_constraint(src_bbox, sample_bbox):
function clip_bbox (line 37) | def clip_bbox(src_bbox):
function bbox_area (line 45) | def bbox_area(src_bbox):
function is_overlap (line 54) | def is_overlap(object_bbox, sample_bbox):
function filter_and_process (line 64) | def filter_and_process(sample_bbox, bboxes, labels, scores=None,
function bbox_area_sampling (line 111) | def bbox_area_sampling(bboxes, labels, scores, target_size, min_size):
function generate_sample_bbox (line 131) | def generate_sample_bbox(sampler):
function generate_sample_bbox_square (line 148) | def generate_sample_bbox_square(sampler, image_width, image_height):
function data_anchor_sampling (line 169) | def data_anchor_sampling(bbox_labels, image_width, image_height, scale_a...
function jaccard_overlap (line 254) | def jaccard_overlap(sample_bbox, object_bbox):
function intersect_bbox (line 273) | def intersect_bbox(bbox1, bbox2):
function bbox_coverage (line 285) | def bbox_coverage(bbox1, bbox2):
function satisfy_sample_constraint (line 296) | def satisfy_sample_constraint(sampler,
function satisfy_sample_constraint_coverage (line 326) | def satisfy_sample_constraint_coverage(sampler, sample_bbox, gt_bboxes):
function crop_image_sampling (line 366) | def crop_image_sampling(img, sample_bbox, image_width, image_height,
function is_poly (line 410) | def is_poly(segm):
function gaussian_radius (line 416) | def gaussian_radius(bbox_size, min_overlap):
function draw_gaussian (line 439) | def draw_gaussian(heatmap, center, radius, k=1, delte=6):
function gaussian2D (line 457) | def gaussian2D(shape, sigma_x=1, sigma_y=1):
function draw_umich_gaussian (line 467) | def draw_umich_gaussian(heatmap, center, radius, k=1):
function get_border (line 490) | def get_border(border, size):
FILE: ppdet/data/transform/operators.py
function register_op (line 63) | def register_op(cls):
class BboxError (line 72) | class BboxError(ValueError):
class ImageError (line 76) | class ImageError(ValueError):
class BaseOperator (line 80) | class BaseOperator(object):
method __init__ (line 81) | def __init__(self, name=None):
method apply (line 86) | def apply(self, sample, context=None):
method __call__ (line 96) | def __call__(self, sample, context=None):
method __str__ (line 111) | def __str__(self):
class Decode (line 116) | class Decode(BaseOperator):
method __init__ (line 117) | def __init__(self, rtn_im_file=False):
method apply (line 123) | def apply(self, sample, context=None):
function _make_dirs (line 164) | def _make_dirs(dirname):
class DecodeCache (line 173) | class DecodeCache(BaseOperator):
method __init__ (line 174) | def __init__(self, cache_root=None):
method apply (line 185) | def apply(self, sample, context=None):
method cache_path (line 221) | def cache_path(dir_oot, im_file):
method load (line 225) | def load(path):
method dump (line 231) | def dump(obj, path):
class SniperDecodeCrop (line 245) | class SniperDecodeCrop(BaseOperator):
method __init__ (line 246) | def __init__(self):
method __call__ (line 249) | def __call__(self, sample, context=None):
class Permute (line 280) | class Permute(BaseOperator):
method __init__ (line 281) | def __init__(self):
method apply (line 287) | def apply(self, sample, context=None):
class Lighting (line 300) | class Lighting(BaseOperator):
method __init__ (line 309) | def __init__(self, eigval, eigvec, alphastd=0.1):
method apply (line 315) | def apply(self, sample, context=None):
class RandomErasingImage (line 325) | class RandomErasingImage(BaseOperator):
method __init__ (line 326) | def __init__(self, prob=0.5, lower=0.02, higher=0.4, aspect_ratio=0.3):
method apply (line 341) | def apply(self, sample, context=None):
class NormalizeImage (line 375) | class NormalizeImage(BaseOperator):
method __init__ (line 376) | def __init__(self,
method apply (line 401) | def apply(self, sample, context=None):
class GridMask (line 440) | class GridMask(BaseOperator):
method __init__ (line 441) | def __init__(self,
method apply (line 483) | def apply(self, sample, context=None):
class RandomDistort (line 489) | class RandomDistort(BaseOperator):
method __init__ (line 502) | def __init__(self,
method apply_hue (line 521) | def apply_hue(self, img):
method apply_saturation (line 531) | def apply_saturation(self, img):
method apply_contrast (line 539) | def apply_contrast(self, img):
method apply_brightness (line 547) | def apply_brightness(self, img):
method apply (line 555) | def apply(self, sample, context=None):
class PhotoMetricDistortion (line 590) | class PhotoMetricDistortion(BaseOperator):
method __init__ (line 611) | def __init__(self,
method apply (line 622) | def apply(self, results, context=None):
method __repr__ (line 680) | def __repr__(self):
class AutoAugment (line 692) | class AutoAugment(BaseOperator):
method __init__ (line 693) | def __init__(self, autoaug_type="v1"):
method apply (line 701) | def apply(self, sample, context=None):
class RandomFlip (line 736) | class RandomFlip(BaseOperator):
method __init__ (line 737) | def __init__(self, prob=0.5):
method apply_segm (line 747) | def apply_segm(self, segms, height, width):
method apply_keypoint (line 772) | def apply_keypoint(self, gt_keypoint, width):
method apply_image (line 779) | def apply_image(self, image):
method apply_bbox (line 782) | def apply_bbox(self, bbox, width):
method apply (line 789) | def apply(self, sample, context=None):
class Resize (line 826) | class Resize(BaseOperator):
method __init__ (line 827) | def __init__(self, target_size, keep_ratio, interp=cv2.INTER_LINEAR):
method apply_image (line 848) | def apply_image(self, image, scale):
method apply_bbox (line 859) | def apply_bbox(self, bbox, scale, size):
method apply_area (line 868) | def apply_area(self, area, scale):
method apply_joints (line 872) | def apply_joints(self, joints, scale, size):
method apply_segm (line 881) | def apply_segm(self, segms, im_size, scale):
method apply (line 920) | def apply(self, sample, context=None):
class MultiscaleTestResize (line 1033) | class MultiscaleTestResize(BaseOperator):
method __init__ (line 1034) | def __init__(self,
method apply (line 1064) | def apply(self, sample, context=None):
class RandomResize (line 1083) | class RandomResize(BaseOperator):
method __init__ (line 1084) | def __init__(self,
method apply (line 1128) | def apply(self, sample, context=None):
class RandomExpand (line 1152) | class RandomExpand(BaseOperator):
method __init__ (line 1160) | def __init__(self, ratio=4., prob=0.5, fill_value=(127.5, 127.5, 127.5)):
method apply (line 1173) | def apply(self, sample, context=None):
class CropWithSampling (line 1197) | class CropWithSampling(BaseOperator):
method __init__ (line 1198) | def __init__(self, batch_sampler, satisfy_all=False, avoid_no_bbox=True):
method apply (line 1222) | def apply(self, sample, context):
class CropWithDataAchorSampling (line 1277) | class CropWithDataAchorSampling(BaseOperator):
method __init__ (line 1278) | def __init__(self,
method apply (line 1317) | def apply(self, sample, context):
class RandomCrop (line 1459) | class RandomCrop(BaseOperator):
method __init__ (line 1473) | def __init__(self,
method crop_segms (line 1494) | def crop_segms(self, segms, valid_ids, crop, height, width):
method polygon_to_rle (line 1564) | def polygon_to_rle(self, polygons, height, width):
method rle_to_polygon (line 1577) | def rle_to_polygon(self, rle_mask, min_area=5):
method set_fake_bboxes (line 1593) | def set_fake_bboxes(self, sample):
method apply (line 1612) | def apply(self, sample, context=None):
method random_crop (line 1629) | def random_crop(self, sample, fake_bboxes=False):
method _iou_matrix (line 1752) | def _iou_matrix(self, a, b):
method _gtcropiou_matrix (line 1762) | def _gtcropiou_matrix(self, a, b):
method _crop_box_with_center_constraint (line 1772) | def _crop_box_with_center_constraint(self, box, crop):
method _crop_image (line 1788) | def _crop_image(self, img, crop):
method _crop_segm (line 1792) | def _crop_segm(self, segm, crop):
method _crop_joints (line 1796) | def _crop_joints(self, joints, crop):
class RandomScaledCrop (line 1808) | class RandomScaledCrop(BaseOperator):
method __init__ (line 1819) | def __init__(self,
method apply_image (line 1841) | def apply_image(self, img, output_size, offset_x, offset_y):
method apply_bbox (line 1852) | def apply_bbox(self, gt_bbox, gt_class, scale, offset_x, offset_y):
method apply_segm (line 1867) | def apply_segm(self, segms, output_size, offset_x, offset_y, valid=None):
method apply (line 1881) | def apply(self, sample, context=None):
class Cutmix (line 1920) | class Cutmix(BaseOperator):
method __init__ (line 1921) | def __init__(self, alpha=1.5, beta=1.5):
method apply_image (line 1937) | def apply_image(self, img1, img2, factor):
method __call__ (line 1964) | def __call__(self, sample, context=None):
class Mixup (line 2009) | class Mixup(BaseOperator):
method __init__ (line 2010) | def __init__(self, alpha=1.5, beta=1.5):
method apply_image (line 2024) | def apply_image(self, img1, img2, factor):
method __call__ (line 2034) | def __call__(self, sample, context=None):
class NormalizeBox (line 2087) | class NormalizeBox(BaseOperator):
method __init__ (line 2090) | def __init__(self, retain_origin_box=False):
method apply (line 2094) | def apply(self, sample, context):
class BboxXYXY2XYWH (line 2126) | class BboxXYXY2XYWH(BaseOperator):
method __init__ (line 2131) | def __init__(self):
method apply (line 2134) | def apply(self, sample, context=None):
class PadBox (line 2146) | class PadBox(BaseOperator):
method __init__ (line 2147) | def __init__(self, num_max_boxes=50):
method apply (line 2156) | def apply(self, sample, context=None):
class DebugVisibleImage (line 2198) | class DebugVisibleImage(BaseOperator):
method __init__ (line 2204) | def __init__(self, output_dir='output/debug', is_normalized=False):
method apply (line 2213) | def apply(self, sample, context=None):
class Pad (line 2262) | class Pad(BaseOperator):
method __init__ (line 2263) | def __init__(self,
method apply_segm (line 2301) | def apply_segm(self, segms, offsets, im_size, size):
method apply_bbox (line 2335) | def apply_bbox(self, bbox, offsets):
method apply_keypoint (line 2338) | def apply_keypoint(self, keypoints, offsets):
method apply_image (line 2342) | def apply_image(self, image, offsets, im_size, size):
method apply (line 2351) | def apply(self, sample, context=None):
class Poly2Mask (line 2409) | class Poly2Mask(BaseOperator):
method __init__ (line 2416) | def __init__(self, del_poly=False):
method _poly2mask (line 2422) | def _poly2mask(self, mask_ann, img_h, img_w):
method apply (line 2437) | def apply(self, sample, context=None):
class AugmentHSV (line 2452) | class AugmentHSV(BaseOperator):
method __init__ (line 2463) | def __init__(self,
method apply (line 2477) | def apply(self, sample, context=None):
class Norm2PixelBbox (line 2520) | class Norm2PixelBbox(BaseOperator):
method __init__ (line 2525) | def __init__(self):
method apply (line 2528) | def apply(self, sample, context=None):
class BboxCXCYWH2XYXY (line 2539) | class BboxCXCYWH2XYXY(BaseOperator):
method __init__ (line 2545) | def __init__(self):
method apply (line 2548) | def apply(self, sample, context=None):
class RandomResizeCrop (line 2560) | class RandomResizeCrop(BaseOperator):
method __init__ (line 2578) | def __init__(self,
method _format_size (line 2607) | def _format_size(self, size):
method apply (line 2612) | def apply(self, sample, context=None):
method _random_crop (line 2627) | def _random_crop(croper, sample, size, context=None):
method _resize (line 2728) | def _resize(resizer, sample, size, mode='short', context=None):
class RandomSelect (line 2825) | class RandomSelect(BaseOperator):
method __init__ (line 2834) | def __init__(self, transforms1, transforms2, p=0.5):
method apply (line 2840) | def apply(self, sample, context=None):
class RandomSelects (line 2847) | class RandomSelects(BaseOperator):
method __init__ (line 2856) | def __init__(self, transforms_list, p=None):
method apply (line 2866) | def apply(self, sample, context=None):
class RandomShortSideResize (line 2877) | class RandomShortSideResize(BaseOperator):
method __init__ (line 2878) | def __init__(self,
method get_size_with_aspect_ratio (line 2909) | def get_size_with_aspect_ratio(self, image_shape, size, max_size=None):
method resize (line 2931) | def resize(self,
method apply_bbox (line 2996) | def apply_bbox(self, bbox, scale, size):
method apply_joints (line 3005) | def apply_joints(self, joints, scale, size):
method apply_area (line 3018) | def apply_area(self, area, scale):
method apply_segm (line 3022) | def apply_segm(self, segms, im_size, scale):
method apply (line 3061) | def apply(self, sample, context=None):
class RandomShortSideRangeResize (line 3070) | class RandomShortSideRangeResize(RandomShortSideResize):
method __init__ (line 3071) | def __init__(self, scales, interp=cv2.INTER_LINEAR, random_interp=False):
method random_sample (line 3088) | def random_sample(self, img_scales):
method apply (line 3098) | def apply(self, sample, context=None):
class RandomSizeCrop (line 3108) | class RandomSizeCrop(BaseOperator):
method __init__ (line 3121) | def __init__(self, min_size, max_size, keep_empty=True):
method get_crop_params (line 3131) | def get_crop_params(img_shape, output_size):
method crop (line 3154) | def crop(self, sample, region):
method apply_bbox (line 3214) | def apply_bbox(self, bbox, region):
method _crop_joints (line 3222) | def _crop_joints(self, joints, region):
method apply_segm (line 3235) | def apply_segm(self, segms, region, image_shape):
method apply (line 3305) | def apply(self, sample, context=None):
class WarpAffine (line 3316) | class WarpAffine(BaseOperator):
method __init__ (line 3317) | def __init__(self,
method apply (line 3338) | def apply(self, sample, context=None):
class FlipWarpAffine (line 3381) | class FlipWarpAffine(BaseOperator):
method __init__ (line 3382) | def __init__(self,
method __call__ (line 3413) | def __call__(self, samples, context=None):
class CenterRandColor (line 3510) | class CenterRandColor(BaseOperator):
method __init__ (line 3518) | def __init__(self, saturation=0.4, contrast=0.4, brightness=0.4):
method apply_saturation (line 3524) | def apply_saturation(self, img, img_gray):
method apply_contrast (line 3530) | def apply_contrast(self, img, img_gray):
method apply_brightness (line 3536) | def apply_brightness(self, img, img_gray):
method _blend (line 3542) | def _blend(self, alpha, img, img_mean):
method apply (line 3547) | def apply(self, sample, context=None):
class Mosaic (line 3573) | class Mosaic(BaseOperator):
method __init__ (line 3596) | def __init__(self,
method get_mosaic_coords (line 3621) | def get_mosaic_coords(self, mosaic_idx, xc, yc, w, h, input_h, input_w):
method random_affine_augment (line 3644) | def random_affine_augment(self,
method __call__ (line 3701) | def __call__(self, sample, context=None):
method mixup_augment (line 3842) | def mixup_augment(self, origin_img, origin_labels, input_dim, cp_labels,
class PadResize (line 3927) | class PadResize(BaseOperator):
method __init__ (line 3935) | def __init__(self, target_size, fill_value=114):
method _resize (line 3942) | def _resize(self, img, bboxes, labels):
method _pad (line 3956) | def _pad(self, img):
method apply (line 3967) | def apply(self, sample, context=None):
class RandomShift (line 3979) | class RandomShift(BaseOperator):
method __init__ (line 3989) | def __init__(self, prob=0.5, max_shift=32, filter_thr=1):
method calc_shift_coor (line 3995) | def calc_shift_coor(self, im_h, im_w, shift_h, shift_w):
method apply (line 4001) | def apply(self, sample, context=None):
class StrongAugImage (line 4040) | class StrongAugImage(BaseOperator):
method __init__ (line 4041) | def __init__(self, transforms):
method apply (line 4045) | def apply(self, sample, context=None):
class RandomColorJitter (line 4054) | class RandomColorJitter(BaseOperator):
method __init__ (line 4055) | def __init__(self,
method apply (line 4068) | def apply(self, sample, context=None):
class RandomGrayscale (line 4079) | class RandomGrayscale(BaseOperator):
method __init__ (line 4080) | def __init__(self, prob=0.2):
method apply (line 4084) | def apply(self, sample, context=None):
class RandomGaussianBlur (line 4093) | class RandomGaussianBlur(BaseOperator):
method __init__ (line 4094) | def __init__(self, prob=0.5, sigma=[0.1, 2.0]):
method apply (line 4099) | def apply(self, sample, context=None):
class RandomErasing (line 4108) | class RandomErasing(BaseOperator):
method __init__ (line 4109) | def __init__(self,
method _erase (line 4135) | def _erase(self, img, i, j, h, w, v, inplace=False):
method _get_param (line 4141) | def _get_param(self, img, scale, ratio, value):
method apply (line 4163) | def apply(self, sample, context=None):
class RandomErasingCrop (line 4184) | class RandomErasingCrop(BaseOperator):
method __init__ (line 4185) | def __init__(self):
method apply (line 4194) | def apply(self, sample, context=None):
FILE: ppdet/data/transform/rotated_operators.py
class RRotate (line 39) | class RRotate(BaseOperator):
method __init__ (line 49) | def __init__(self, scale=1.0, angle=0., fill_value=0., auto_bound=True):
method get_rotated_matrix (line 56) | def get_rotated_matrix(self, angle, scale, h, w):
method get_rect_from_pts (line 77) | def get_rect_from_pts(self, pts, h, w):
method apply_image (line 90) | def apply_image(self, image, matrix, h, w):
method apply_pts (line 94) | def apply_pts(self, pts, matrix, h, w):
method apply (line 105) | def apply(self, sample, context=None):
class RandomRRotate (line 121) | class RandomRRotate(BaseOperator):
method __init__ (line 133) | def __init__(self,
method get_angle (line 150) | def get_angle(self, angle, angle_mode):
method get_scale (line 162) | def get_scale(self, scale, scale_mode):
method apply (line 174) | def apply(self, sample, context=None):
class Poly2RBox (line 185) | class Poly2RBox(BaseOperator):
method __init__ (line 195) | def __init__(self, filter_threshold=4, filter_mode=None, rbox_type='le...
method filter (line 200) | def filter(self, size, threshold, mode):
method get_rbox (line 209) | def get_rbox(self, polys):
method apply (line 230) | def apply(self, sample, context=None):
class Poly2Array (line 242) | class Poly2Array(BaseOperator):
method __init__ (line 246) | def __init__(self):
method apply (line 249) | def apply(self, sample, context=None):
class RResize (line 258) | class RResize(BaseOperator):
method __init__ (line 259) | def __init__(self, target_size, keep_ratio, interp=cv2.INTER_LINEAR):
method apply_image (line 280) | def apply_image(self, image, scale):
method apply_pts (line 291) | def apply_pts(self, pts, scale, size):
method apply (line 300) | def apply(self, sample, context=None):
class RandomRFlip (line 360) | class RandomRFlip(BaseOperator):
method __init__ (line 361) | def __init__(self, prob=0.5):
method apply_image (line 371) | def apply_image(self, image):
method apply_pts (line 374) | def apply_pts(self, pts, width):
method apply (line 379) | def apply(self, sample, context=None):
class VisibleRBox (line 406) | class VisibleRBox(BaseOperator):
method __init__ (line 412) | def __init__(self, output_dir='debug'):
method apply (line 418) | def apply(self, sample, context=None):
class Rbox2Poly (line 463) | class Rbox2Poly(BaseOperator):
method __init__ (line 468) | def __init__(self):
method apply (line 471) | def apply(self, sample, context=None):
FILE: ppdet/data/utils.py
function default_collate_fn (line 25) | def default_collate_fn(batch):
FILE: ppdet/engine/callbacks.py
class Callback (line 42) | class Callback(object):
method __init__ (line 43) | def __init__(self, model):
method on_step_begin (line 52) | def on_step_begin(self, status):
method on_step_end (line 55) | def on_step_end(self, status):
method on_epoch_begin (line 58) | def on_epoch_begin(self, status):
method on_epoch_end (line 61) | def on_epoch_end(self, status):
method on_train_begin (line 64) | def on_train_begin(self, status):
method on_train_end (line 67) | def on_train_end(self, status):
class ComposeCallback (line 71) | class ComposeCallback(object):
method __init__ (line 72) | def __init__(self, callbacks):
method on_step_begin (line 79) | def on_step_begin(self, status):
method on_step_end (line 83) | def on_step_end(self, status):
method on_epoch_begin (line 87) | def on_epoch_begin(self, status):
method on_epoch_end (line 91) | def on_epoch_end(self, status):
method on_train_begin (line 95) | def on_train_begin(self, status):
method on_train_end (line 99) | def on_train_end(self, status):
class LogPrinter (line 104) | class LogPrinter(Callback):
method __init__ (line 105) | def __init__(self, model):
method on_step_end (line 108) | def on_step_end(self, status):
method on_epoch_end (line 167) | def on_epoch_end(self, status):
class Checkpointer (line 177) | class Checkpointer(Callback):
method __init__ (line 178) | def __init__(self, model):
method on_epoch_end (line 188) | def on_epoch_end(self, status):
class WiferFaceEval (line 291) | class WiferFaceEval(Callback):
method __init__ (line 292) | def __init__(self, model):
method on_epoch_begin (line 295) | def on_epoch_begin(self, status):
class VisualDLWriter (line 303) | class VisualDLWriter(Callback):
method __init__ (line 308) | def __init__(self, model):
method on_step_end (line 325) | def on_step_end(self, status):
method on_epoch_end (line 349) | def on_epoch_end(self, status):
class WandbCallback (line 361) | class WandbCallback(Callback):
method __init__ (line 362) | def __init__(self, model):
method run (line 392) | def run(self):
method save_model (line 404) | def save_model(self,
method on_step_end (line 446) | def on_step_end(self, status):
method on_epoch_end (line 474) | def on_epoch_end(self, status):
method on_train_end (line 544) | def on_train_end(self, status):
class SniperProposalsGenerator (line 548) | class SniperProposalsGenerator(Callback):
method __init__ (line 549) | def __init__(self, model):
method _create_new_dataset (line 557) | def _create_new_dataset(self, ori_dataset):
method _eval_with_loader (line 569) | def _eval_with_loader(self, loader):
method on_train_end (line 585) | def on_train_end(self, status):
class SemiLogPrinter (line 607) | class SemiLogPrinter(LogPrinter):
method __init__ (line 608) | def __init__(self, model):
method on_step_end (line 611) | def on_step_end(self, status):
class SemiCheckpointer (line 665) | class SemiCheckpointer(Checkpointer):
method __init__ (line 666) | def __init__(self, model):
method every_n_iters (line 683) | def every_n_iters(self, iter_id, n):
method on_step_end (line 686) | def on_step_end(self, status):
method on_epoch_end (line 706) | def on_epoch_end(self, status):
FILE: ppdet/engine/env.py
function init_fleet_env (line 29) | def init_fleet_env(find_unused_parameters=False):
function init_parallel_env (line 35) | def init_parallel_env():
function set_random_seed (line 47) | def set_random_seed(seed):
FILE: ppdet/engine/export_utils.py
function apply_to_static (line 199) | def apply_to_static(config, model):
function _prune_input_spec (line 207) | def _prune_input_spec(input_spec, program, targets):
function _parse_reader (line 236) | def _parse_reader(reader_cfg, dataset_cfg, metric, arch, image_shape):
function _parse_tracker (line 283) | def _parse_tracker(tracker_cfg):
function _dump_infer_config (line 290) | def _dump_infer_config(config, path, image_shape, model):
FILE: ppdet/engine/naive_sync_bn.py
class _AllReduce (line 7) | class _AllReduce(paddle.autograd.PyLayer):
method forward (line 9) | def forward(ctx, input):
method backward (line 17) | def backward(ctx, grad_output):
function differentiable_all_reduce (line 22) | def differentiable_all_reduce(input):
class NaiveSyncBatchNorm (line 35) | class NaiveSyncBatchNorm(nn.BatchNorm2D):
method __init__ (line 37) | def __init__(self, *args, stats_mode="", **kwargs):
method forward (line 42) | def forward(self, input):
function convert_syncbn (line 91) | def convert_syncbn(model):
FILE: ppdet/engine/tracker.py
class Tracker (line 52) | class Tracker(object):
method __init__ (line 53) | def __init__(self, cfg, mode='eval'):
method _init_callbacks (line 89) | def _init_callbacks(self):
method _init_metrics (line 93) | def _init_metrics(self):
method _reset_metrics (line 109) | def _reset_metrics(self):
method register_callbacks (line 113) | def register_callbacks(self, callbacks):
method register_metrics (line 121) | def register_metrics(self, metrics):
method load_weights_jde (line 128) | def load_weights_jde(self, weights):
method load_weights_sde (line 131) | def load_weights_sde(self, det_weights, reid_weights):
method _eval_seq_centertrack (line 142) | def _eval_seq_centertrack(self,
method _eval_seq_jde (line 189) | def _eval_seq_jde(self,
method _eval_seq_sde (line 244) | def _eval_seq_sde(self,
method mot_evaluate (line 485) | def mot_evaluate(self,
method get_infer_images (line 591) | def get_infer_images(self, infer_dir):
method mot_predict_seq (line 607) | def mot_predict_seq(self,
function get_trick_hyperparams (line 702) | def get_trick_hyperparams(video_name, ori_buffer, ori_thresh):
FILE: ppdet/engine/trainer.py
class Trainer (line 66) | class Trainer(object):
method __init__ (line 67) | def __init__(self, cfg, mode='train'):
method _init_callbacks (line 263) | def _init_callbacks(self):
method _init_metrics (line 289) | def _init_metrics(self, validate=False):
method _reset_metrics (line 460) | def _reset_metrics(self):
method register_callbacks (line 464) | def register_callbacks(self, callbacks):
method register_metrics (line 472) | def register_metrics(self, metrics):
method load_weights (line 479) | def load_weights(self, weights, ARSL_eval=False):
method load_weights_sde (line 486) | def load_weights_sde(self, det_weights, reid_weights):
method resume_weights (line 494) | def resume_weights(self, weights):
method train (line 504) | def train(self, validate=False):
method _eval_with_loader (line 705) | def _eval_with_loader(self, loader):
method evaluate (line 753) | def evaluate(self):
method _eval_with_loader_slice (line 766) | def _eval_with_loader_slice(self,
method evaluate_slice (line 847) | def evaluate_slice(self,
method slice_predict (line 858) | def slice_predict(self,
method predict (line 1014) | def predict(self,
method _get_save_image_name (line 1149) | def _get_save_image_name(self, output_dir, image_path):
method _get_infer_cfg_and_input_spec (line 1157) | def _get_infer_cfg_and_input_spec(self,
method export (line 1272) | def export(self, output_dir='output_inference', for_fd=False):
method post_quant (line 1309) | def post_quant(self, output_dir='output_inference'):
method _flops (line 1331) | def _flops(self, loader):
method parse_mot_images (line 1360) | def parse_mot_images(self, cfg):
method predict_culane (line 1386) | def predict_culane(self,
method reset_norm_param_attr (line 1490) | def reset_norm_param_attr(self, layer, **kwargs):
FILE: ppdet/engine/trainer_cot.py
class TrainerCot (line 22) | class TrainerCot(Trainer):
method __init__ (line 27) | def __init__(self, cfg, mode='train'):
method cotuning_init (line 31) | def cotuning_init(self):
FILE: ppdet/engine/trainer_ssod.py
class Trainer_DenseTeacher (line 46) | class Trainer_DenseTeacher(Trainer):
method __init__ (line 47) | def __init__(self, cfg, mode='train'):
method load_weights (line 147) | def load_weights(self, weights):
method resume_weights (line 156) | def resume_weights(self, weights, exchange=True):
method train (line 167) | def train(self, validate=False):
method evaluate (line 407) | def evaluate(self):
method _eval_with_loader (line 420) | def _eval_with_loader(self, loader):
class Trainer_ARSL (line 475) | class Trainer_ARSL(Trainer):
method __init__ (line 476) | def __init__(self, cfg, mode='train'):
method resume_weights (line 538) | def resume_weights(self, weights):
method train (line 547) | def train(self, validate=False):
method merge_data (line 661) | def merge_data(self, data1, data2):
method run_step_full_semisup (line 670) | def run_step_full_semisup(self, data):
method export (line 738) | def export(self, output_dir='output_inference'):
method _eval_with_loader (line 800) | def _eval_with_loader(self, loader, mode="teacher"):
method evaluate (line 834) | def evaluate(self):
method _update_teacher_model (line 839) | def _update_teacher_model(self, keep_rate=0.996):
class EnsembleTSModel (line 854) | class EnsembleTSModel(nn.Layer):
method __init__ (line 855) | def __init__(self, modelTeacher, modelStudent):
class Trainer_Semi_RTDETR (line 861) | class Trainer_Semi_RTDETR(Trainer):
method __init__ (line 862) | def __init__(self, cfg, mode='train'):
method load_semi_weights (line 940) | def load_semi_weights(self, t_weights, s_weights):
method resume_weights (line 951) | def resume_weights(self, weights, exchange=True):
method train (line 963) | def train(self, validate=False):
method _eval_with_loader (line 1122) | def _eval_with_loader(self, loader):
method evaluate (line 1190) | def evaluate(self):
FILE: ppdet/ext_op/csrc/matched_rbox_iou/matched_rbox_iou.cc
function matched_rbox_iou_cpu_kernel (line 22) | void matched_rbox_iou_cpu_kernel(const int rbox_num, const T *rbox1_data...
function MatchedRboxIouCPUForward (line 35) | std::vector<paddle::Tensor>
function MatchedRboxIouForward (line 63) | std::vector<paddle::Tensor> MatchedRboxIouForward(const paddle::Tensor &...
function MatchedRboxIouInferShape (line 75) | std::vector<std::vector<int64_t>>
function MatchedRboxIouInferDtype (line 81) | std::vector<paddle::DataType> MatchedRboxIouInferDtype(paddle::DataType t1,
FILE: ppdet/ext_op/csrc/nms_rotated/nms_rotated.cc
function nms_rotated_cpu_kernel (line 19) | void nms_rotated_cpu_kernel(const T *boxes_data, const float threshold,
function NMSRotatedCPUForward (line 59) | std::vector<paddle::Tensor> NMSRotatedCPUForward(const paddle::Tensor &b...
function NMSRotatedForward (line 92) | std::vector<paddle::Tensor> NMSRotatedForward(const paddle::Tensor &boxes,
function NMSRotatedInferShape (line 104) | std::vector<std::vector<int64_t>>
function NMSRotatedInferDtype (line 110) | std::vector<paddle::DataType> NMSRotatedInferDtype(paddle::DataType t1,
FILE: ppdet/ext_op/csrc/rbox_iou/rbox_iou.cc
function rbox_iou_cpu_kernel (line 22) | void rbox_iou_cpu_kernel(const int rbox1_num, const int rbox2_num,
function RboxIouCPUForward (line 39) | std::vector<paddle::Tensor> RboxIouCPUForward(const paddle::Tensor &rbox1,
function RboxIouForward (line 67) | std::vector<paddle::Tensor> RboxIouForward(const paddle::Tensor &rbox1,
function RboxIouInferShape (line 79) | std::vector<std::vector<int64_t>>
function RboxIouInferDtype (line 85) | std::vector<paddle::DataType> RboxIouInferDtype(paddle::DataType t1,
FILE: ppdet/ext_op/csrc/rbox_iou/rbox_iou_utils.h
function T (line 58) | T dot_2d(const Point<T> &A, const Point<T> &B) {
function T (line 63) | T cross_2d(const Point<T> &A, const Point<T> &B) {
function get_rotated_vertices (line 68) | void get_rotated_vertices(const RotatedBox<T> &box,
function get_intersection_points (line 89) | int get_intersection_points(const Point<T> (&pts1)[4],
function HOST_DEVICE (line 354) | HOST_DEVICE inline int CeilDiv(const int a, const int b) {
FILE: ppdet/ext_op/setup.py
function get_extensions (line 7) | def get_extensions():
FILE: ppdet/ext_op/unittest/test_matched_rbox_iou.py
function rbox2poly_single (line 11) | def rbox2poly_single(rrect, get_best_begin_point=False):
function intersection (line 31) | def intersection(g, p):
function matched_rbox_overlaps (line 71) | def matched_rbox_overlaps(anchors, gt_bboxes, use_cv2=False):
function gen_sample (line 100) | def gen_sample(n):
class MatchedRBoxIoUTest (line 107) | class MatchedRBoxIoUTest(unittest.TestCase):
method setUp (line 108) | def setUp(self):
method initTestCase (line 113) | def initTestCase(self):
method assertAllClose (line 116) | def assertAllClose(self, x, y, msg, atol=5e-1, rtol=1e-2):
method get_places (line 119) | def get_places(self):
method check_output (line 126) | def check_output(self, place):
method test_output (line 142) | def test_output(self):
FILE: ppdet/ext_op/unittest/test_rbox_iou.py
function rbox2poly_single (line 11) | def rbox2poly_single(rrect, get_best_begin_point=False):
function intersection (line 31) | def intersection(g, p):
function rbox_overlaps (line 71) | def rbox_overlaps(anchors, gt_bboxes, use_cv2=False):
function gen_sample (line 101) | def gen_sample(n):
class RBoxIoUTest (line 108) | class RBoxIoUTest(unittest.TestCase):
method setUp (line 109) | def setUp(self):
method initTestCase (line 114) | def initTestCase(self):
method assertAllClose (line 118) | def assertAllClose(self, x, y, msg, atol=5e-1, rtol=1e-2):
method get_places (line 121) | def get_places(self):
method check_output (line 128) | def check_output(self, place):
method test_output (line 144) | def test_output(self):
FILE: ppdet/metrics/coco_utils.py
function get_infer_results (line 31) | def get_infer_results(outs, catid, bias=0, save_threshold=0):
function cocoapi_eval (line 81) | def cocoapi_eval(jsonfile,
function json_eval_results (line 179) | def json_eval_results(metric, json_directory, dataset):
FILE: ppdet/metrics/culane_metrics.py
function draw_lane (line 39) | def draw_lane(lane, img=None, img_shape=None, width=30):
function discrete_cross_iou (line 49) | def discrete_cross_iou(xs, ys, width=30, img_shape=(590, 1640, 3)):
function continuous_cross_iou (line 60) | def continuous_cross_iou(xs, ys, width=30, img_shape=(590, 1640, 3)):
function interp (line 82) | def interp(points, n=50):
function culane_metric (line 91) | def culane_metric(pred,
function load_culane_img_data (line 129) | def load_culane_img_data(path):
function load_culane_data (line 141) | def load_culane_data(data_dir, file_list_path):
function eval_predictions (line 158) | def eval_predictions(pred_dir,
class CULaneMetric (line 230) | class CULaneMetric(Metric):
method __init__ (line 231) | def __init__(self,
method reset (line 248) | def reset(self):
method get_prediction_string (line 254) | def get_prediction_string(self, pred):
method accumulate (line 272) | def accumulate(self):
method update (line 316) | def update(self, inputs, outputs):
method log (line 322) | def log(self):
method get_results (line 326) | def get_results(self):
FILE: ppdet/metrics/fast_cocoeval/ext/cocoeval.cc
function SortInstancesByDetectionScore (line 30) | void SortInstancesByDetectionScore(
function SortInstancesByIgnore (line 46) | void SortInstancesByIgnore(
function MatchDetectionsToGroundTruth (line 73) | void MatchDetectionsToGroundTruth(
function EvaluateImages (line 154) | std::vector<ImageEvaluation> EvaluateImages(
function list_to_vec (line 215) | std::vector<T> list_to_vec(const py::list& l) {
function BuildSortedDetectionList (line 235) | int BuildSortedDetectionList(
function ComputePrecisionRecallCurve (line 296) | void ComputePrecisionRecallCurve(
function Accumulate (line 384) | py::dict Accumulate(
function PYBIND11_MODULE (line 517) | PYBIND11_MODULE(cocoeval_ext, m) {
FILE: ppdet/metrics/fast_cocoeval/ext/cocoeval.h
type InstanceAnnotation (line 29) | struct InstanceAnnotation {
type ImageEvaluation (line 47) | struct ImageEvaluation {
FILE: ppdet/metrics/fast_cocoeval/fast_cocoeval.py
class FastCOCOeval (line 29) | class FastCOCOeval(COCOeval):
method evaluate (line 35) | def evaluate(self):
method accumulate (line 116) | def accumulate(self, p=None):
FILE: ppdet/metrics/json_results.py
function get_det_res (line 18) | def get_det_res(bboxes,
function get_det_poly_res (line 52) | def get_det_poly_res(bboxes, bbox_nums, image_id, label_to_cat_id_map, b...
function strip_mask (line 76) | def strip_mask(mask):
function get_seg_res (line 84) | def get_seg_res(masks, bboxes, mask_nums, image_id, label_to_cat_id_map):
function get_solov2_segm_res (line 117) | def get_solov2_segm_res(results, image_id, num_id_to_cat_id_map):
function get_keypoint_res (line 146) | def get_keypoint_res(results, im_id):
function get_pose3d_res (line 170) | def get_pose3d_res(results, im_id):
FILE: ppdet/metrics/keypoint_metrics.py
class KeyPointTopDownCOCOEval (line 33) | class KeyPointTopDownCOCOEval(object):
method __init__ (line 39) | def __init__(self,
method reset (line 60) | def reset(self):
method update (line 70) | def update(self, inputs, outputs):
method _write_coco_keypoint_results (line 96) | def _write_coco_keypoint_results(self, keypoints):
method _coco_keypoint_results_one_category_kernel (line 121) | def _coco_keypoint_results_one_category_kernel(self, data_pack):
method get_final_results (line 146) | def get_final_results(self, preds, all_boxes, img_path):
method accumulate (line 193) | def accumulate(self):
method log (line 213) | def log(self):
method get_results (line 228) | def get_results(self):
class KeyPointTopDownCOCOWholeBadyHandEval (line 232) | class KeyPointTopDownCOCOWholeBadyHandEval(object):
method __init__ (line 233) | def __init__(self,
method parse_dataset (line 249) | def parse_dataset(self):
method reset (line 278) | def reset(self):
method update (line 286) | def update(self, inputs, outputs):
method accumulate (line 293) | def accumulate(self):
method get_final_results (line 302) | def get_final_results(self, preds):
method _write_keypoint_results (line 309) | def _write_keypoint_results(self, keypoints):
method log (line 327) | def log(self):
method get_results (line 333) | def get_results(self):
method evaluate (line 336) | def evaluate(self, res_file, metrics, pck_thr=0.2, auc_nor=30):
class KeyPointTopDownMPIIEval (line 390) | class KeyPointTopDownMPIIEval(object):
method __init__ (line 391) | def __init__(self,
method reset (line 404) | def reset(self):
method update (line 409) | def update(self, inputs, outputs):
method accumulate (line 424) | def accumulate(self):
method _mpii_keypoint_results_save (line 433) | def _mpii_keypoint_results_save(self):
method log (line 448) | def log(self):
method get_results (line 454) | def get_results(self):
method evaluate (line 457) | def evaluate(self, outputs, savepath=None):
method _sort_and_unique_bboxes (line 563) | def _sort_and_unique_bboxes(self, kpts, key='bbox_id'):
FILE: ppdet/metrics/lvis_utils.py
function lvisapi_eval (line 23) | def lvisapi_eval(jsonfile,
FILE: ppdet/metrics/map_utils.py
function draw_pr_curve (line 41) | def draw_pr_curve(precision,
function bbox_area (line 65) | def bbox_area(bbox, is_bbox_normalized):
function jaccard_overlap (line 75) | def jaccard_overlap(pred, gt, is_bbox_normalized=False):
function calc_rbox_iou (line 94) | def calc_rbox_iou(pred, gt_poly):
function prune_zero_padding (line 131) | def prune_zero_padding(gt_box, gt_label, difficult=None):
class DetectionMAP (line 141) | class DetectionMAP(object):
method __init__ (line 164) | def __init__(self,
method update (line 186) | def update(self, bbox, score, label, gt_box, gt_label, difficult=None):
method reset (line 227) | def reset(self):
method accumulate (line 235) | def accumulate(self):
method get_map (line 296) | def get_map(self):
method _get_tp_fp_accum (line 337) | def _get_tp_fp_accum(self, score_pos_list):
function ap_per_class (line 355) | def ap_per_class(tp, conf, pred_cls, target_cls):
function compute_ap (line 409) | def compute_ap(recall, precision):
FILE: ppdet/metrics/mcmot_metrics.py
function parse_accs_metrics (line 82) | def parse_accs_metrics(seq_acc, index_name, verbose=False):
function seqs_overall_metrics (line 98) | def seqs_overall_metrics(summary_df, verbose=False):
class MCMOTMetricOverall (line 132) | class MCMOTMetricOverall(object):
method motp_overall (line 133) | def motp_overall(summary_df, overall_dic):
method mota_overall (line 139) | def mota_overall(summary_df, overall_dic):
method precision_overall (line 146) | def precision_overall(summary_df, overall_dic):
method recall_overall (line 152) | def recall_overall(summary_df, overall_dic):
method idp_overall (line 158) | def idp_overall(summary_df, overall_dic):
method idr_overall (line 164) | def idr_overall(summary_df, overall_dic):
method idf1_overall (line 170) | def idf1_overall(summary_df, overall_dic):
function read_mcmot_results_union (line 177) | def read_mcmot_results_union(filename, is_gt, is_ignore):
function read_mcmot_results (line 227) | def read_mcmot_results(filename, is_gt, is_ignore):
function read_results (line 255) | def read_results(filename,
function unzip_objs (line 279) | def unzip_objs(objs):
function unzip_objs_cls (line 288) | def unzip_objs_cls(objs):
class MCMOTEvaluator (line 300) | class MCMOTEvaluator(object):
method __init__ (line 301) | def __init__(self, data_root, seq_name, data_type, num_classes):
method load_annotations (line 319) | def load_annotations(self):
method reset_accumulator (line 328) | def reset_accumulator(self):
method eval_frame_dict (line 331) | def eval_frame_dict(self, trk_objs, gt_objs, rtn_events=False, union=F...
method eval_file (line 368) | def eval_file(self, result_filename):
method get_summary (line 401) | def get_summary(accs,
method save_summary (line 417) | def save_summary(summary, filename):
class MCMOTMetric (line 424) | class MCMOTMetric(Metric):
method __init__ (line 425) | def __init__(self, num_classes, save_summary=False):
method reset (line 434) | def reset(self):
method update (line 438) | def update(self, data_root, seq, data_type, result_root, result_filena...
method accumulate (line 455) | def accumulate(self):
method log (line 466) | def log(self):
method get_results (line 472) | def get_results(self):
FILE: ppdet/metrics/metrics.py
class Metric (line 53) | class Metric(paddle.metric.Metric):
method name (line 54) | def name(self):
method reset (line 57) | def reset(self):
method accumulate (line 60) | def accumulate(self):
method log (line 67) | def log(self):
method get_results (line 71) | def get_results(self):
class COCOMetric (line 75) | class COCOMetric(Metric):
method __init__ (line 76) | def __init__(self, anno_file, **kwargs):
method reset (line 99) | def reset(self):
method update (line 104) | def update(self, inputs, outputs):
method accumulate (line 134) | def accumulate(self):
method log (line 224) | def log(self):
method get_results (line 227) | def get_results(self):
class LVISMetric (line 230) | class LVISMetric(Metric):
method __init__ (line 231) | def __init__(self, anno_file, **kwargs):
method reset (line 252) | def reset(self):
method update (line 257) | def update(self, inputs, outputs):
method accumulate (line 281) | def accumulate(self):
method log (line 372) | def log(self):
method get_results (line 376) | def get_results(self):
class VOCMetric (line 379) | class VOCMetric(Metric):
method __init__ (line 380) | def __init__(self,
method reset (line 410) | def reset(self):
method update (line 414) | def update(self, inputs, outputs):
method accumulate (line 467) | def accumulate(self):
method log (line 480) | def log(self):
method get_results (line 485) | def get_results(self):
class WiderFaceMetric (line 489) | class WiderFaceMetric(Metric):
method __init__ (line 490) | def __init__(self, iou_thresh=0.5):
method reset (line 494) | def reset(self):
method update (line 503) | def update(self, data, outs):
method accumulate (line 531) | def accumulate(self):
method log (line 565) | def log(self):
method get_results (line 572) | def get_results(self):
class RBoxMetric (line 578) | class RBoxMetric(Metric):
method __init__ (line 579) | def __init__(self, anno_file, **kwargs):
method reset (line 602) | def reset(self):
method update (line 606) | def update(self, inputs, outputs):
method save_results (line 655) | def save_results(self, results, output_dir, imid2path):
method accumulate (line 683) | def accumulate(self):
method log (line 691) | def log(self):
method get_results (line 696) | def get_results(self):
class SNIPERCOCOMetric (line 700) | class SNIPERCOCOMetric(COCOMetric):
method __init__ (line 701) | def __init__(self, anno_file, **kwargs):
method reset (line 706) | def reset(self):
method update (line 712) | def update(self, inputs, outputs):
method accumulate (line 724) | def accumulate(self):
FILE: ppdet/metrics/mot_metrics.py
function read_mot_results (line 46) | def read_mot_results(filename, is_gt=False, is_ignore=False):
function unzip_objs (line 110) | def unzip_objs(objs):
class MOTEvaluator (line 119) | class MOTEvaluator(object):
method __init__ (line 120) | def __init__(self, data_root, seq_name, data_type):
method load_annotations (line 135) | def load_annotations(self):
method reset_accumulator (line 147) | def reset_accumulator(self):
method eval_frame (line 150) | def eval_frame(self, frame_id, trk_tlwhs, trk_ids, rtn_events=False):
method eval_file (line 191) | def eval_file(self, filename):
method get_summary (line 204) | def get_summary(accs,
method save_summary (line 219) | def save_summary(summary, filename):
class MOTMetric (line 226) | class MOTMetric(Metric):
method __init__ (line 227) | def __init__(self, save_summary=False):
method reset (line 233) | def reset(self):
method update (line 237) | def update(self, data_root, seq, data_type, result_root, result_filena...
method accumulate (line 243) | def accumulate(self):
method log (line 255) | def log(self):
method get_results (line 258) | def get_results(self):
class JDEDetMetric (line 262) | class JDEDetMetric(Metric):
method __init__ (line 265) | def __init__(self, overlap_thresh=0.5):
method reset (line 269) | def reset(self):
method update (line 273) | def update(self, inputs, outputs):
method accumulate (line 313) | def accumulate(self):
method log (line 317) | def log(self):
method get_results (line 322) | def get_results(self):
class tData (line 331) | class tData:
method __init__ (line 335) | def __init__(self,frame=-1,obj_type="unset",truncation=-1,occlusion=-1,\
method __str__ (line 363) | def __str__(self):
class KITTIEvaluation (line 368) | class KITTIEvaluation(object):
method __init__ (line 385) | def __init__(self, result_path, gt_path, min_overlap=0.5, max_truncati...
method loadGroundtruth (line 461) | def loadGroundtruth(self):
method loadTracker (line 468) | def loadTracker(self):
method _loadData (line 477) | def _loadData(self,
method boxoverlap (line 630) | def boxoverlap(self, a, b, criterion="union"):
method compute3rdPartyMetrics (line 658) | def compute3rdPartyMetrics(self):
method createSummary (line 1079) | def createSummary(self):
method printEntry (line 1147) | def printEntry(self, key, val, width=(70, 10)):
method saveToStats (line 1162) | def saveToStats(self, save_summary):
class KITTIMOTMetric (line 1176) | class KITTIMOTMetric(Metric):
method __init__ (line 1177) | def __init__(self, save_summary=True):
method reset (line 1183) | def reset(self):
method update (line 1189) | def update(self, data_root, seq, data_type, result_root, result_filena...
method accumulate (line 1213) | def accumulate(self):
method log (line 1242) | def log(self):
method get_results (line 1245) | def get_results(self):
FILE: ppdet/metrics/munkres.py
class Munkres (line 23) | class Munkres:
method __init__ (line 29) | def __init__(self):
method make_cost_matrix (line 40) | def make_cost_matrix(profit_matrix, inversion_function):
method pad_matrix (line 51) | def pad_matrix(self, matrix, pad_value=0):
method compute (line 87) | def compute(self, cost_matrix):
method __copy_matrix (line 147) | def __copy_matrix(self, matrix):
method __make_matrix (line 151) | def __make_matrix(self, n, val):
method __step1 (line 158) | def __step1(self):
method __step2 (line 174) | def __step2(self):
method __step3 (line 193) | def __step3(self):
method __step4 (line 214) | def __step4(self):
method __step5 (line 247) | def __step5(self):
method __step6 (line 283) | def __step6(self):
method __find_smallest (line 299) | def __find_smallest(self):
method __find_a_zero (line 309) | def __find_a_zero(self):
method __find_star_in_row (line 335) | def __find_star_in_row(self, row):
method __find_star_in_col (line 348) | def __find_star_in_col(self, col):
method __find_prime_in_row (line 361) | def __find_prime_in_row(self, row):
method __convert_path (line 374) | def __convert_path(self, path, count):
method __clear_covers (line 381) | def __clear_covers(self):
method __erase_primes (line 387) | def __erase_primes(self):
function make_cost_matrix (line 395) | def make_cost_matrix(profit_matrix, inversion_function):
FILE: ppdet/metrics/pose3d_metrics.py
class AverageMeter (line 27) | class AverageMeter(object):
method __init__ (line 28) | def __init__(self):
method reset (line 31) | def reset(self):
method update (line 37) | def update(self, val, n=1):
function mean_per_joint_position_error (line 44) | def mean_per_joint_position_error(pred, gt, has_3d_joints):
function compute_similarity_transform (line 61) | def compute_similarity_transform(S1, S2):
function compute_similarity_transform_batch (line 111) | def compute_similarity_transform_batch(S1, S2):
function reconstruction_error (line 119) | def reconstruction_error(S1, S2, reduction='mean'):
function all_gather (line 130) | def all_gather(data):
class Pose3DEval (line 139) | class Pose3DEval(object):
method __init__ (line 140) | def __init__(self, output_eval, save_prediction_only=False):
method reset (line 147) | def reset(self):
method get_human36m_joints (line 152) | def get_human36m_joints(self, input):
method update (line 159) | def update(self, inputs, outputs):
method accumulate (line 179) | def accumulate(self):
method log (line 186) | def log(self):
method get_results (line 199) | def get_results(self):
FILE: ppdet/metrics/widerface_utils.py
function face_eval_run (line 32) | def face_eval_run(model,
function detect_face (line 80) | def detect_face(model, image, shrink):
function flip_test (line 115) | def flip_test(model, image, shrink):
function multi_scale_test (line 128) | def multi_scale_test(model, image, max_shrink):
function multi_scale_test_pyramid (line 163) | def multi_scale_test_pyramid(model, image, max_shrink):
function to_chw (line 191) | def to_chw(image):
function face_img_process (line 204) | def face_img_process(image,
function get_shrink (line 217) | def get_shrink(height, width):
function bbox_vote (line 256) | def bbox_vote(det):
function save_widerface_bboxes (line 301) | def save_widerface_bboxes(image_path, bboxes_scores, output_dir):
function save_fddb_bboxes (line 320) | def save_fddb_bboxes(bboxes_scores,
function lmk2out (line 339) | def lmk2out(results, is_bbox_normalized=False):
function image_eval (line 393) | def image_eval(pred, gt, ignore, iou_thresh):
function bbox_overlaps (line 426) | def bbox_overlaps(boxes1, boxes2):
function img_pr_info (line 460) | def img_pr_info(thresh_num, pred_info, proposal_list, pred_recall):
function dataset_pr_info (line 477) | def dataset_pr_info(thresh_num, pr_curve, count_face):
function voc_ap (line 485) | def voc_ap(rec, prec):
FILE: ppdet/model_zoo/model_zoo.py
function list_model (line 38) | def list_model(filters=[]):
function get_config_file (line 68) | def get_config_file(model_name):
function get_weights_url (line 72) | def get_weights_url(model_name):
function get_model (line 76) | def get_model(model_name, pretrained=True):
FILE: ppdet/model_zoo/tests/test_get_model.py
class TestGetConfigFile (line 29) | class TestGetConfigFile(unittest.TestCase):
method test_main (line 30) | def test_main(self):
class TestGetModel (line 38) | class TestGetModel(unittest.TestCase):
method test_main (line 39) | def test_main(self):
FILE: ppdet/model_zoo/tests/test_list_model.py
class TestListModel (line 23) | class TestListModel(unittest.TestCase):
method setUp (line 24) | def setUp(self):
method test_main (line 27) | def test_main(self):
class TestListModelYOLO (line 35) | class TestListModelYOLO(TestListModel):
method setUp (line 36) | def setUp(self):
class TestListModelRCNN (line 40) | class TestListModelRCNN(TestListModel):
method setUp (line 41) | def setUp(self):
class TestListModelSSD (line 45) | class TestListModelSSD(TestListModel):
method setUp (line 46) | def setUp(self):
class TestListModelMultiFilter (line 50) | class TestListModelMultiFilter(TestListModel):
method setUp (line 51) | def setUp(self):
class TestListModelError (line 55) | class TestListModelError(unittest.TestCase):
method setUp (line 56) | def setUp(self):
method test_main (line 59) | def test_main(self):
FILE: ppdet/modeling/architectures/blazeface.py
class BlazeFace (line 28) | class BlazeFace(BaseArch):
method __init__ (line 43) | def __init__(self, backbone, blaze_head, neck, post_process):
method from_config (line 51) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 67) | def _forward(self):
method get_loss (line 99) | def get_loss(self, ):
method get_pred (line 102) | def get_pred(self):
FILE: ppdet/modeling/architectures/bytetrack.py
class ByteTrack (line 26) | class ByteTrack(BaseArch):
method __init__ (line 37) | def __init__(self,
method from_config (line 47) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 63) | def _forward(self):
method get_loss (line 78) | def get_loss(self):
method get_pred (line 81) | def get_pred(self):
FILE: ppdet/modeling/architectures/cascade_rcnn.py
class CascadeRCNN (line 27) | class CascadeRCNN(BaseArch):
method __init__ (line 46) | def __init__(self,
method from_config (line 65) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 86) | def _forward(self):
method get_loss (line 124) | def get_loss(self, ):
method get_pred (line 135) | def get_pred(self):
FILE: ppdet/modeling/architectures/centernet.py
class CenterNet (line 26) | class CenterNet(BaseArch):
method __init__ (line 42) | def __init__(self,
method from_config (line 56) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 68) | def _forward(self):
method get_pred (line 79) | def get_pred(self):
method get_loss (line 102) | def get_loss(self):
FILE: ppdet/modeling/architectures/centertrack.py
class CenterTrack (line 33) | class CenterTrack(BaseArch):
method __init__ (line 45) | def __init__(self,
method from_config (line 59) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 73) | def _forward(self):
method get_pred (line 131) | def get_pred(self):
method get_loss (line 134) | def get_loss(self):
method reset_tracking (line 137) | def reset_tracking(self):
method get_additional_inputs (line 141) | def get_additional_inputs(self, dets, meta, with_hm=True):
function affine_transform_bbox (line 170) | def affine_transform_bbox(bbox, trans, width, height):
FILE: ppdet/modeling/architectures/clrnet.py
class CLRNet (line 9) | class CLRNet(BaseArch):
method __init__ (line 12) | def __init__(self,
method from_config (line 24) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 40) | def _forward(self):
method get_loss (line 63) | def get_loss(self):
method get_pred (line 66) | def get_pred(self):
FILE: ppdet/modeling/architectures/deepsort.py
class DeepSORT (line 28) | class DeepSORT(BaseArch):
method __init__ (line 39) | def __init__(self,
method from_config (line 49) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 63) | def _forward(self):
method get_pred (line 69) | def get_pred(self):
FILE: ppdet/modeling/architectures/detr.py
class DETR (line 28) | class DETR(BaseArch):
method __init__ (line 33) | def __init__(self,
method from_config (line 53) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 79) | def _forward(self):
method get_loss (line 114) | def get_loss(self):
method get_pred (line 117) | def get_pred(self):
FILE: ppdet/modeling/architectures/detr_ssod.py
class DETR_SSOD (line 35) | class DETR_SSOD(MultiSteamDetector):
method __init__ (line 36) | def __init__(self,
method from_config (line 62) | def from_config(cls, cfg):
method forward_train (line 77) | def forward_train(self, inputs, **kwargs):
method foward_unsup_train (line 168) | def foward_unsup_train(self, data_unsup_w, data_unsup_s):
method compute_pseudo_label_loss (line 226) | def compute_pseudo_label_loss(self, student_unsup, teacher_info,
function box_cxcywh_to_xyxy (line 298) | def box_cxcywh_to_xyxy(x):
function box_xyxy_to_cxcywh (line 304) | def box_xyxy_to_cxcywh(x):
function get_size_with_aspect_ratio (line 310) | def get_size_with_aspect_ratio(image_size, size, max_size=None):
function align_weak_strong_shape (line 331) | def align_weak_strong_shape(data_weak, data_strong):
FILE: ppdet/modeling/architectures/fairmot.py
class FairMOT (line 27) | class FairMOT(BaseArch):
method __init__ (line 42) | def __init__(self,
method from_config (line 54) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 70) | def _forward(self):
method get_pred (line 94) | def get_pred(self):
method get_loss (line 98) | def get_loss(self):
FILE: ppdet/modeling/architectures/faster_rcnn.py
class FasterRCNN (line 28) | class FasterRCNN(BaseArch):
method __init__ (line 42) | def __init__(self,
method init_cot_head (line 55) | def init_cot_head(self, relationship):
method from_config (line 59) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 75) | def _forward(self):
method get_loss (line 112) | def get_loss(self, ):
method get_pred (line 121) | def get_pred(self):
method target_bbox_forward (line 134) | def target_bbox_forward(self, data):
method relationship_learning (line 144) | def relationship_learning(self, loader, num_classes_novel):
FILE: ppdet/modeling/architectures/fcos.py
class FCOS (line 27) | class FCOS(BaseArch):
method __init__ (line 41) | def __init__(self,
method from_config (line 56) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 71) | def _forward(self):
method get_loss (line 85) | def get_loss(self):
method get_pred (line 88) | def get_pred(self):
method get_loss_keys (line 91) | def get_loss_keys(self):
method get_ssod_loss (line 94) | def get_ssod_loss(self, student_head_outs, teacher_head_outs, train_cfg):
class ARSL_FCOS (line 101) | class ARSL_FCOS(BaseArch):
method __init__ (line 115) | def __init__(self,
method from_config (line 127) | def from_config(cls, cfg, *args, **kwargs):
method forward (line 146) | def forward(self, inputs, branch="supervised", teacher_prediction=None):
method model_forward (line 170) | def model_forward(self):
method get_loss (line 177) | def get_loss(self):
method get_pseudo_loss (line 198) | def get_pseudo_loss(self, teacher_prediction):
method get_pred (line 207) | def get_pred(self):
method get_pseudo_pred (line 216) | def get_pseudo_pred(self):
FILE: ppdet/modeling/architectures/gfl.py
class GFL (line 27) | class GFL(BaseArch):
method __init__ (line 39) | def __init__(self, backbone, neck, head='GFLHead'):
method from_config (line 46) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 61) | def _forward(self):
method get_loss (line 74) | def get_loss(self, ):
method get_pred (line 84) | def get_pred(self):
FILE: ppdet/modeling/architectures/jde.py
class JDE (line 26) | class JDE(BaseArch):
method __init__ (line 41) | def __init__(self,
method from_config (line 53) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 67) | def _forward(self):
method get_loss (line 106) | def get_loss(self):
method get_pred (line 109) | def get_pred(self):
FILE: ppdet/modeling/architectures/keypoint_hrhrnet.py
class HigherHRNet (line 33) | class HigherHRNet(BaseArch):
method __init__ (line 36) | def __init__(self,
method from_config (line 64) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 78) | def _forward(self):
method get_loss (line 111) | def get_loss(self):
method get_pred (line 114) | def get_pred(self):
method get_topk (line 120) | def get_topk(self, outputs):
class HrHRNetPostProcess (line 143) | class HrHRNetPostProcess(object):
method __init__ (line 160) | def __init__(self, max_num_people=30, heat_thresh=0.1, tag_thresh=1.):
method lerp (line 165) | def lerp(self, j, y, x, heatmap):
method __call__ (line 177) | def __call__(self, heatmap, tagmap, heat_k, inds_k, original_height,
FILE: ppdet/modeling/architectures/keypoint_hrnet.py
class TopDownHRNet (line 33) | class TopDownHRNet(BaseArch):
method __init__ (line 37) | def __init__(self,
method from_config (line 67) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 73) | def _forward(self):
method get_loss (line 107) | def get_loss(self):
method get_pred (line 110) | def get_pred(self):
method flip_back (line 115) | def flip_back(self, output_flipped, matched_parts):
class HRNetPostProcess (line 129) | class HRNetPostProcess(object):
method __init__ (line 130) | def __init__(self, use_dark=True):
method get_max_preds (line 133) | def get_max_preds(self, heatmaps):
method gaussian_blur (line 169) | def gaussian_blur(self, heatmap, kernel):
method dark_parse (line 185) | def dark_parse(self, hm, coord):
method dark_postprocess (line 207) | def dark_postprocess(self, hm, coords, kernelsize):
method get_final_preds (line 220) | def get_final_preds(self, heatmaps, center, scale, kernelsize=3):
method __call__ (line 261) | def __call__(self, output, center, scale):
class TinyPose3DPostProcess (line 271) | class TinyPose3DPostProcess(object):
method __init__ (line 272) | def __init__(self):
method __call__ (line 275) | def __call__(self, output, center, scale):
function soft_argmax (line 294) | def soft_argmax(heatmaps, joint_num):
class TinyPose3DHRHeatmapNet (line 320) | class TinyPose3DHRHeatmapNet(BaseArch):
method __init__ (line 324) | def __init__(
method from_config (line 347) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 353) | def _forward(self):
method get_loss (line 360) | def get_loss(self):
method get_pred (line 366) | def get_pred(self):
method flip_back (line 371) | def flip_back(self, output_flipped, matched_parts):
class TinyPose3DHRNet (line 386) | class TinyPose3DHRNet(BaseArch):
method __init__ (line 390) | def __init__(self,
method from_config (line 419) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 425) | def _forward(self):
method get_loss (line 449) | def get_loss(self):
method get_pred (line 452) | def get_pred(self):
method flip_back (line 457) | def flip_back(self, output_flipped, matched_parts):
FILE: ppdet/modeling/architectures/keypoint_petr.py
class PETR (line 30) | class PETR(BaseArch):
method __init__ (line 34) | def __init__(self,
method extract_feat (line 54) | def extract_feat(self, img):
method get_inputs (line 61) | def get_inputs(self):
method get_loss (line 89) | def get_loss(self):
method get_pred_numpy (line 128) | def get_pred_numpy(self):
method get_pred (line 146) | def get_pred(self):
method simple_test (line 167) | def simple_test(self, inputs, img_metas, rescale=False):
method bbox_kpt2result (line 195) | def bbox_kpt2result(self, bboxes, labels, kpts, num_classes):
FILE: ppdet/modeling/architectures/keypoint_vitpose.py
class VitPose_TopDown (line 32) | class VitPose_TopDown(BaseArch):
method __init__ (line 36) | def __init__(self, backbone, head, loss, post_process, flip_test):
method from_config (line 53) | def from_config(cls, cfg, *args, **kwargs):
method _forward_train (line 67) | def _forward_train(self):
method _forward_test (line 73) | def _forward_test(self):
method get_loss (line 97) | def get_loss(self):
method get_pred (line 100) | def get_pred(self):
class VitPosePostProcess (line 108) | class VitPosePostProcess(object):
method __init__ (line 109) | def __init__(self, use_dark=False):
method get_max_preds (line 112) | def get_max_preds(self, heatmaps):
method post_datk_udp (line 148) | def post_datk_udp(self, coords, batch_heatmaps, kernel=3):
method transform_preds_udp (line 211) | def transform_preds_udp(self,
method get_final_preds (line 265) | def get_final_preds(self, heatmaps, center, scale, kernelsize=11):
method __call__ (line 310) | def __call__(self, output, center, scale):
FILE: ppdet/modeling/architectures/mask_rcnn.py
class MaskRCNN (line 27) | class MaskRCNN(BaseArch):
method __init__ (line 47) | def __init__(self,
method from_config (line 66) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 87) | def _forward(self):
method get_loss (line 135) | def get_loss(self, ):
method get_pred (line 145) | def get_pred(self):
FILE: ppdet/modeling/architectures/meta_arch.py
class BaseArch (line 17) | class BaseArch(nn.Layer):
method __init__ (line 18) | def __init__(self, data_format='NCHW', use_extra_data=False):
method load_meanstd (line 25) | def load_meanstd(self, cfg_transform):
method forward (line 44) | def forward(self, inputs):
method merge_multi_scale_predictions (line 85) | def merge_multi_scale_predictions(self, outs):
method build_inputs (line 119) | def build_inputs(self, data, input_def):
method model_arch (line 125) | def model_arch(self, ):
method get_loss (line 128) | def get_loss(self, ):
method get_pred (line 131) | def get_pred(self, ):
FILE: ppdet/modeling/architectures/multi_stream_detector.py
class MultiSteamDetector (line 6) | class MultiSteamDetector(BaseArch):
method __init__ (line 7) | def __init__(self,
method forward (line 22) | def forward(self, inputs, return_loss=True, **kwargs):
method get_loss (line 37) | def get_loss(self, **kwargs):
method model (line 42) | def model(self, **kwargs) -> BaseArch:
method freeze (line 52) | def freeze(self, model_ref: str):
method update_ema_model (line 59) | def update_ema_model(self, momentum=0.9996):
FILE: ppdet/modeling/architectures/picodet.py
class PicoDet (line 27) | class PicoDet(BaseArch):
method __init__ (line 39) | def __init__(self, backbone, neck, head='PicoHead', nms_cpu=False):
method from_config (line 49) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 64) | def _forward(self):
method get_loss (line 79) | def get_loss(self, ):
method get_pred (line 89) | def get_pred(self):
FILE: ppdet/modeling/architectures/pose3d_metro.py
function orthographic_projection (line 29) | def orthographic_projection(X, camera):
class METRO_Body (line 45) | class METRO_Body(BaseArch):
method __init__ (line 49) | def __init__(
method from_config (line 72) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 79) | def _forward(self):
method get_loss (line 105) | def get_loss(self):
method get_pred (line 111) | def get_pred(self):
FILE: ppdet/modeling/architectures/ppyoloe.py
class PPYOLOE (line 30) | class PPYOLOE(BaseArch):
method __init__ (line 50) | def __init__(self,
method from_config (line 79) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 94) | def _forward(self):
method get_loss (line 140) | def get_loss(self):
method get_pred (line 143) | def get_pred(self):
method get_loss_keys (line 146) | def get_loss_keys(self):
method get_ssod_loss (line 149) | def get_ssod_loss(self, student_head_outs, teacher_head_outs, train_cfg):
class PPYOLOEWithAuxHead (line 156) | class PPYOLOEWithAuxHead(BaseArch):
method __init__ (line 160) | def __init__(self,
method from_config (line 191) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 212) | def _forward(self):
method get_loss (line 246) | def get_loss(self):
method get_pred (line 249) | def get_pred(self):
FILE: ppdet/modeling/architectures/queryinst.py
class QueryInst (line 28) | class QueryInst(BaseArch):
method __init__ (line 32) | def __init__(self,
method from_config (line 46) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 62) | def _forward(self, targets=None):
method get_loss (line 80) | def get_loss(self):
method get_pred (line 102) | def get_pred(self):
FILE: ppdet/modeling/architectures/retinanet.py
class RetinaNet (line 28) | class RetinaNet(BaseArch):
method __init__ (line 31) | def __init__(self, backbone, neck, head):
method from_config (line 38) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 53) | def _forward(self):
method get_loss (line 80) | def get_loss(self):
method get_pred (line 83) | def get_pred(self):
FILE: ppdet/modeling/architectures/rtdetrv3.py
class RTDETRV3 (line 28) | class RTDETRV3(BaseArch):
method __init__ (line 33) | def __init__(self,
method from_config (line 55) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 85) | def _forward(self):
method get_loss (line 131) | def get_loss(self):
method get_pred (line 134) | def get_pred(self):
FILE: ppdet/modeling/architectures/s2anet.py
class S2ANet (line 27) | class S2ANet(BaseArch):
method __init__ (line 31) | def __init__(self, backbone, neck, head):
method from_config (line 46) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 57) | def _forward(self):
method get_loss (line 77) | def get_loss(self, ):
method get_pred (line 81) | def get_pred(self):
FILE: ppdet/modeling/architectures/solov2.py
class SOLOv2 (line 28) | class SOLOv2(BaseArch):
method __init__ (line 41) | def __init__(self, backbone, solov2_head, mask_head, neck=None):
method from_config (line 49) | def from_config(cls, cfg, *args, **kwargs):
method model_arch (line 66) | def model_arch(self):
method get_loss (line 76) | def get_loss(self, ):
method get_pred (line 100) | def get_pred(self):
FILE: ppdet/modeling/architectures/sparse_rcnn.py
class SparseRCNN (line 26) | class SparseRCNN(BaseArch):
method __init__ (line 30) | def __init__(self,
method from_config (line 42) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 57) | def _forward(self):
method get_loss (line 70) | def get_loss(self):
method get_pred (line 96) | def get_pred(self):
FILE: ppdet/modeling/architectures/ssd.py
class SSD (line 28) | class SSD(BaseArch):
method __init__ (line 41) | def __init__(self, backbone, ssd_head, post_process, r34_backbone=False):
method from_config (line 56) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 69) | def _forward(self):
method get_loss (line 101) | def get_loss(self, ):
method get_pred (line 104) | def get_pred(self):
FILE: ppdet/modeling/architectures/tood.py
class TOOD (line 26) | class TOOD(BaseArch):
method __init__ (line 37) | def __init__(self, backbone, neck, head):
method from_config (line 44) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 59) | def _forward(self):
method get_loss (line 71) | def get_loss(self):
method get_pred (line 74) | def get_pred(self):
FILE: ppdet/modeling/architectures/ttfnet.py
class TTFNet (line 27) | class TTFNet(BaseArch):
method __init__ (line 41) | def __init__(self,
method from_config (line 53) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 68) | def _forward(self):
method get_loss (line 79) | def get_loss(self, ):
method get_pred (line 92) | def get_pred(self):
FILE: ppdet/modeling/architectures/yolo.py
class YOLOv3 (line 29) | class YOLOv3(BaseArch):
method __init__ (line 34) | def __init__(self,
method from_config (line 62) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 80) | def _forward(self):
method get_loss (line 146) | def get_loss(self):
method get_pred (line 149) | def get_pred(self):
FILE: ppdet/modeling/architectures/yolof.py
class YOLOF (line 26) | class YOLOF(BaseArch):
method __init__ (line 29) | def __init__(self,
method from_config (line 51) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 69) | def _forward(self):
method get_loss (line 84) | def get_loss(self):
method get_pred (line 87) | def get_pred(self):
FILE: ppdet/modeling/architectures/yolox.py
class YOLOX (line 31) | class YOLOX(BaseArch):
method __init__ (line 47) | def __init__(self,
method from_config (line 70) | def from_config(cls, cfg, *args, **kwargs):
method _forward (line 88) | def _forward(self):
method get_loss (line 104) | def get_loss(self):
method get_pred (line 107) | def get_pred(self):
method _preprocess (line 110) | def _preprocess(self):
method _get_size (line 128) | def _get_size(self):
FILE: ppdet/modeling/assigners/atss_assigner.py
class ATSSAssigner (line 34) | class ATSSAssigner(nn.Layer):
method __init__ (line 40) | def __init__(self,
method _gather_topk_pyramid (line 53) | def _gather_topk_pyramid(self, gt2anchor_distances, num_anchors_list,
method forward (line 75) | def forward(self,
FILE: ppdet/modeling/assigners/clrnet_assigner.py
function distance_cost (line 6) | def distance_cost(predictions, targets, img_w):
function focal_cost (line 25) | def focal_cost(cls_pred, gt_labels, alpha=0.25, gamma=2, eps=1e-12):
function dynamic_k_assign (line 44) | def dynamic_k_assign(cost, pair_wise_ious):
function cdist_paddle (line 83) | def cdist_paddle(x1, x2, p=2):
function assign (line 99) | def assign(predictions,
FILE: ppdet/modeling/assigners/fcosr_assigner.py
class FCOSRAssigner (line 33) | class FCOSRAssigner(nn.Layer):
method __init__ (line 45) | def __init__(self,
method get_gaussian_distribution_score (line 61) | def get_gaussian_distribution_score(self, points, gt_rboxes, gt_polys):
method get_rotated_inside_mask (line 96) | def get_rotated_inside_mask(self, points, gt_polys, scores):
method get_inside_range_mask (line 101) | def get_inside_range_mask(self, points, gt_bboxes, gt_rboxes, stride_t...
method forward (line 134) | def forward(self,
FILE: ppdet/modeling/assigners/hungarian_assigner.py
class AssignResult (line 31) | class AssignResult:
method __init__ (line 49) | def __init__(self, num_gts, gt_inds, max_overlaps, labels=None):
method num_preds (line 58) | def num_preds(self):
method set_extra_property (line 62) | def set_extra_property(self, key, value):
method get_extra_property (line 67) | def get_extra_property(self, key):
method info (line 72) | def info(self):
class PoseHungarianAssigner (line 86) | class PoseHungarianAssigner:
method __init__ (line 110) | def __init__(self,
method assign (line 118) | def assign(self,
class SamplingResult (line 221) | class SamplingResult:
method __init__ (line 225) | def __init__(self, pos_inds, neg_inds, bboxes, gt_bboxes, assign_result,
method bboxes (line 257) | def bboxes(self):
method __nice__ (line 261) | def __nice__(self):
method info (line 270) | def info(self):
class PseudoSampler (line 284) | class PseudoSampler:
method __init__ (line 287) | def __init__(self, **kwargs):
method _sample_pos (line 290) | def _sample_pos(self, **kwargs):
method _sample_neg (line 294) | def _sample_neg(self, **kwargs):
method sample (line 298) | def sample(self, assign_result, bboxes, gt_bboxes, *args, **kwargs):
FILE: ppdet/modeling/assigners/max_iou_assigner.py
class MaxIoUAssigner (line 25) | class MaxIoUAssigner(object):
method __init__ (line 34) | def __init__(self,
method __call__ (line 42) | def __call__(self, bboxes, gt_bboxes):
FILE: ppdet/modeling/assigners/pose_utils.py
function masked_fill (line 28) | def masked_fill(x, mask, value):
class KptL1Cost (line 34) | class KptL1Cost(object):
method __init__ (line 43) | def __init__(self, weight=1.0):
method __call__ (line 46) | def __call__(self, kpt_pred, gt_keypoints, valid_kpt_flag):
class OksCost (line 84) | class OksCost(object):
method __init__ (line 94) | def __init__(self, num_keypoints=17, weight=1.0):
method __call__ (line 113) | def __call__(self, kpt_pred, gt_keypoints, valid_kpt_flag, gt_areas):
class ClassificationCost (line 160) | class ClassificationCost:
method __init__ (line 167) | def __init__(self, weight=1.):
method __call__ (line 170) | def __call__(self, cls_pred, gt_labels):
class FocalLossCost (line 190) | class FocalLossCost:
method __init__ (line 202) | def __init__(self,
method _focal_loss_cost (line 214) | def _focal_loss_cost(self, cls_pred, gt_labels):
method _mask_focal_loss_cost (line 237) | def _mask_focal_loss_cost(self, cls_pred, gt_labels):
method __call__ (line 262) | def __call__(self, cls_pred, gt_labels):
FILE: ppdet/modeling/assigners/rotated_task_aligned_assigner.py
class RotatedTaskAlignedAssigner (line 31) | class RotatedTaskAlignedAssigner(nn.Layer):
method __init__ (line 35) | def __init__(self, topk=13, alpha=1.0, beta=6.0, eps=1e-9):
method forward (line 43) | def forward(self,
FILE: ppdet/modeling/assigners/simota_assigner.py
class SimOTAAssigner (line 28) | class SimOTAAssigner(object):
method __init__ (line 44) | def __init__(self,
method get_in_gt_and_in_center_info (line 58) | def get_in_gt_and_in_center_info(self, flatten_center_and_stride,
method dynamic_k_matching (line 115) | def dynamic_k_matching(self, cost_matrix, pairwise_ious, num_gt):
method get_sample (line 145) | def get_sample(self, assign_gt_inds, gt_bboxes):
method __call__ (line 160) | def __call__(self,
FILE: ppdet/modeling/assigners/task_aligned_assigner.py
function is_close_gt (line 31) | def is_close_gt(anchor, gt, stride_lst, max_dist=2.0, alpha=2.):
class TaskAlignedAssigner (line 56) | class TaskAlignedAssigner(nn.Layer):
method __init__ (line 60) | def __init__(self,
method forward (line 74) | def forward(self,
FILE: ppdet/modeling/assigners/task_aligned_assigner_cr.py
class TaskAlignedAssigner_CR (line 32) | class TaskAlignedAssigner_CR(nn.Layer):
method __init__ (line 36) | def __init__(self,
method forward (line 50) | def forward(self,
FILE: ppdet/modeling/assigners/uniform_assigner.py
function batch_p_dist (line 26) | def batch_p_dist(x, y, p=2):
class UniformAssigner (line 37) | class UniformAssigner(nn.Layer):
method __init__ (line 38) | def __init__(self, pos_ignore_thr, neg_ignore_thr, match_times=4):
method forward (line 44) | def forward(self, bbox_pred, anchor, gt_bboxes, gt_labels=None):
FILE: ppdet/modeling/assigners/utils.py
function pad_gt (line 29) | def pad_gt(gt_labels, gt_bboxes, gt_scores=None):
function gather_topk_anchors (line 83) | def gather_topk_anchors(metrics, topk, largest=True, topk_mask=None, eps...
function check_points_inside_bboxes (line 108) | def check_points_inside_bboxes(points,
function compute_max_iou_anchor (line 153) | def compute_max_iou_anchor(ious):
function compute_max_iou_gt (line 167) | def compute_max_iou_gt(ious):
function generate_anchors_for_grid_cell (line 181) | def generate_anchors_for_grid_cell(feats,
FILE: ppdet/modeling/backbones/blazenet.py
function hard_swish (line 30) | def hard_swish(x):
class ConvBNLayer (line 34) | class ConvBNLayer(nn.Layer):
method __init__ (line 35) | def __init__(self,
method forward (line 64) | def forward(self, x):
class BlazeBlock (line 78) | class BlazeBlock(nn.Layer):
method __init__ (line 79) | def __init__(self,
method forward (line 201) | def forward(self, x):
class BlazeNet (line 218) | class BlazeNet(nn.Layer):
method __init__ (line 228) | def __init__(
method forward (line 306) | def forward(self, inputs):
method out_shape (line 315) | def out_shape(self):
FILE: ppdet/modeling/backbones/clrnet_resnet.py
class BasicBlock (line 49) | class BasicBlock(nn.Layer):
method __init__ (line 52) | def __init__(self,
method forward (line 78) | def forward(self, x):
class BottleneckBlock (line 97) | class BottleneckBlock(nn.Layer):
method __init__ (line 101) | def __init__(self,
method forward (line 136) | def forward(self, x):
class ResNet (line 159) | class ResNet(nn.Layer):
method __init__ (line 191) | def __init__(self, block, depth=50, width=64, with_pool=True, groups=1):
method _make_layer (line 234) | def _make_layer(self, block, planes, blocks, stride=1, dilate=False):
method out_shape (line 268) | def out_shape(self):
method forward (line 275) | def forward(self, x):
class CLRResNet (line 299) | class CLRResNet(nn.Layer):
method __init__ (line 300) | def __init__(self,
method out_shape (line 327) | def out_shape(self):
method forward (line 330) | def forward(self, x):
function _resnet (line 337) | def _resnet(arch, Block, depth, pretrained, **kwargs):
function resnet18 (line 350) | def resnet18(pretrained=False, **kwargs):
function resnet34 (line 375) | def resnet34(pretrained=False, **kwargs):
function resnet50 (line 400) | def resnet50(pretrained=False, **kwargs):
function resnet101 (line 425) | def resnet101(pretrained=False, **kwargs):
function resnet152 (line 450) | def resnet152(pretrained=False, **kwargs):
function resnext50_32x4d (line 475) | def resnext50_32x4d(pretrained=False, **kwargs):
function resnext50_64x4d (line 503) | def resnext50_64x4d(pretrained=False, **kwargs):
function resnext101_32x4d (line 531) | def resnext101_32x4d(pretrained=False, **kwargs):
function resnext101_64x4d (line 560) | def resnext101_64x4d(pretrained=False, **kwargs):
function resnext152_32x4d (line 589) | def resnext152_32x4d(pretrained=False, **kwargs):
function resnext152_64x4d (line 618) | def resnext152_64x4d(pretrained=False, **kwargs):
function wide_resnet50_2 (line 647) | def wide_resnet50_2(pretrained=False, **kwargs):
function wide_resnet101_2 (line 673) | def wide_resnet101_2(pretrained=False, **kwargs):
FILE: ppdet/modeling/backbones/convnext.py
class Block (line 37) | class Block(nn.Layer):
method __init__ (line 49) | def __init__(self, dim, drop_path=0., layer_scale_init_value=1e-6):
method forward (line 69) | def forward(self, x):
class LayerNorm (line 84) | class LayerNorm(nn.Layer):
method __init__ (line 91) | def __init__(self, normalized_shape, eps=1e-6, data_format="channels_l...
method forward (line 107) | def forward(self, x):
class ConvNeXt (line 121) | class ConvNeXt(nn.Layer):
method __init__ (line 157) | def __init__(
method _init_weights (line 221) | def _init_weights(self, m):
method forward_features (line 226) | def forward_features(self, x):
method forward (line 239) | def forward(self, x):
method out_shape (line 244) | def out_shape(self):
FILE: ppdet/modeling/backbones/csp_darknet.py
class BaseConv (line 29) | class BaseConv(nn.Layer):
method __init__ (line 30) | def __init__(self,
method _init_weights (line 54) | def _init_weights(self):
method forward (line 57) | def forward(self, x):
class DWConv (line 64) | class DWConv(nn.Layer):
method __init__ (line 67) | def __init__(self,
method forward (line 92) | def forward(self, x):
class Focus (line 96) | class Focus(nn.Layer):
method __init__ (line 99) | def __init__(self,
method forward (line 115) | def forward(self, inputs):
class BottleNeck (line 126) | class BottleNeck(nn.Layer):
method __init__ (line 127) | def __init__(self,
method forward (line 149) | def forward(self, x):
class SPPLayer (line 156) | class SPPLayer(nn.Layer):
method __init__ (line 159) | def __init__(self,
method forward (line 178) | def forward(self, x):
class SPPFLayer (line 185) | class SPPFLayer(nn.Layer):
method __init__ (line 190) | def __init__(self,
method forward (line 206) | def forward(self, x):
class CSPLayer (line 216) | class CSPLayer(nn.Layer):
method __init__ (line 219) | def __init__(self,
method forward (line 252) | def forward(self, x):
class CSPDarkNet (line 263) | class CSPDarkNet(nn.Layer):
method __init__ (line 292) | def __init__(self,
method forward (line 388) | def forward(self, inputs):
method out_shape (line 399) | def out_shape(self):
FILE: ppdet/modeling/backbones/cspresnet.py
class ConvBNLayer (line 33) | class ConvBNLayer(nn.Layer):
method __init__ (line 34) | def __init__(self,
method forward (line 60) | def forward(self, x):
class RepVggBlock (line 68) | class RepVggBlock(nn.Layer):
method __init__ (line 69) | def __init__(self, ch_in, ch_out, act='relu', alpha=False):
method forward (line 87) | def forward(self, x):
method convert_to_deploy (line 98) | def convert_to_deploy(self):
method get_equivalent_kernel_bias (line 113) | def get_equivalent_kernel_bias(self):
method _pad_1x1_to_3x3_tensor (line 123) | def _pad_1x1_to_3x3_tensor(self, kernel1x1):
method _fuse_bn_tensor (line 129) | def _fuse_bn_tensor(self, branch):
class BasicBlock (line 143) | class BasicBlock(nn.Layer):
method __init__ (line 144) | def __init__(self,
method forward (line 156) | def forward(self, x):
class EffectiveSELayer (line 165) | class EffectiveSELayer(nn.Layer):
method __init__ (line 170) | def __init__(self, channels, act='hardsigmoid'):
method forward (line 176) | def forward(self, x):
class CSPResStage (line 182) | class CSPResStage(nn.Layer):
method __init__ (line 183) | def __init__(self,
method forward (line 217) | def forward(self, x):
class CSPResNet (line 231) | class CSPResNet(nn.Layer):
method __init__ (line 234) | def __init__(self,
method forward (line 300) | def forward(self, inputs):
method out_shape (line 316) | def out_shape(self):
FILE: ppdet/modeling/backbones/darknet.py
class ConvBNLayer (line 26) | class ConvBNLayer(nn.Layer):
method __init__ (line 27) | def __init__(self,
method forward (line 75) | def forward(self, inputs):
class DownSample (line 85) | class DownSample(nn.Layer):
method __init__ (line 86) | def __init__(self,
method forward (line 125) | def forward(self, inputs):
class BasicBlock (line 130) | class BasicBlock(nn.Layer):
method __init__ (line 131) | def __init__(self,
method forward (line 178) | def forward(self, inputs):
class Blocks (line 185) | class Blocks(nn.Layer):
method __init__ (line 186) | def __init__(self,
method forward (line 232) | def forward(self, inputs):
class DarkNet (line 244) | class DarkNet(nn.Layer):
method __init__ (line 247) | def __init__(self,
method forward (line 327) | def forward(self, inputs):
method out_shape (line 344) | def out_shape(self):
FILE: ppdet/modeling/backbones/dla.py
class BasicBlock (line 25) | class BasicBlock(nn.Layer):
method __init__ (line 26) | def __init__(self, ch_in, ch_out, stride=1):
method forward (line 43) | def forward(self, inputs, residual=None):
class Root (line 58) | class Root(nn.Layer):
method __init__ (line 59) | def __init__(self, ch_in, ch_out, kernel_size, residual):
method forward (line 70) | def forward(self, inputs):
class Tree (line 80) | class Tree(nn.Layer):
method __init__ (line 81) | def __init__(self,
method forward (line 137) | def forward(self, x, residual=None, children=None):
class DLA (line 155) | class DLA(nn.Layer):
method __init__ (line 166) | def __init__(self,
method _make_conv_level (line 247) | def _make_conv_level(self, ch_in, ch_out, conv_num, stride=1):
method out_shape (line 263) | def out_shape(self):
method forward (line 268) | def forward(self, inputs):
FILE: ppdet/modeling/backbones/esnet.py
function make_divisible (line 36) | def make_divisible(v, divisor=16, min_value=None):
class SEModule (line 45) | class SEModule(nn.Layer):
method __init__ (line 46) | def __init__(self, channel, reduction=4):
method forward (line 66) | def forward(self, inputs):
class InvertedResidual (line 75) | class InvertedResidual(nn.Layer):
method __init__ (line 76) | def __init__(self,
method forward (line 110) | def forward(self, inputs):
class InvertedResidualDS (line 124) | class InvertedResidualDS(nn.Layer):
method __init__ (line 125) | def __init__(self,
method forward (line 193) | def forward(self, inputs):
class ESNet (line 209) | class ESNet(nn.Layer):
method __init__ (line 210) | def __init__(self,
method _update_out_channels (line 273) | def _update_out_channels(self, channel, feature_idx, feature_maps):
method forward (line 277) | def forward(self, inputs):
method out_shape (line 289) | def out_shape(self):
FILE: ppdet/modeling/backbones/focalnet.py
class FocalModulation (line 190) | class FocalModulation(nn.Layer):
method __init__ (line 202) | def __init__(self,
method forward (line 253) | def forward(self, x):
class FocalModulationBlock (line 281) | class FocalModulationBlock(nn.Layer):
method __init__ (line 299) | def __init__(self,
method forward (line 348) | def forward(self, x):
class BasicLayer (line 377) | class BasicLayer(nn.Layer):
method __init__ (line 398) | def __init__(self,
method forward (line 450) | def forward(self, x, H, W):
class PatchEmbed (line 470) | class PatchEmbed(nn.Layer):
method __init__ (line 481) | def __init__(self,
method forward (line 520) | def forward(self, x):
class FocalNet (line 544) | class FocalNet(nn.Layer):
method __init__ (line 571) | def __init__(
method _freeze_stages (line 672) | def _freeze_stages(self):
method _init_weights (line 686) | def _init_weights(self, m):
method forward (line 695) | def forward(self, x):
method out_shape (line 714) | def out_shape(self):
FILE: ppdet/modeling/backbones/ghostnet.py
class ExtraBlockDW (line 31) | class ExtraBlockDW(nn.Layer):
method __init__ (line 32) | def __init__(self,
method forward (line 85) | def forward(self, inputs):
class SEBlock (line 92) | class SEBlock(nn.Layer):
method __init__ (line 93) | def __init__(self, num_channels, lr_mult, reduction_ratio=4, name=None):
method forward (line 113) | def forward(self, inputs):
class GhostModule (line 125) | class GhostModule(nn.Layer):
method __init__ (line 126) | def __init__(self,
method forward (line 172) | def forward(self, inputs):
class GhostBottleneck (line 179) | class GhostBottleneck(nn.Layer):
method __init__ (line 180) | def __init__(self,
method forward (line 275) | def forward(self, inputs):
class GhostNet (line 299) | class GhostNet(nn.Layer):
method __init__ (line 302) | def __init__(
method _update_out_channels (line 442) | def _update_out_channels(self, channel, feature_idx, feature_maps):
method forward (line 446) | def forward(self, inputs):
method out_shape (line 469) | def out_shape(self):
FILE: ppdet/modeling/backbones/hardnet.py
function ConvLayer (line 23) | def ConvLayer(in_channels,
function DWConvLayer (line 41) | def DWConvLayer(in_channels,
function CombConvLayer (line 58) | def CombConvLayer(in_channels, out_channels, kernel_size=1, stride=1):
class HarDBlock (line 67) | class HarDBlock(nn.Layer):
method __init__ (line 68) | def __init__(self,
method get_out_ch (line 94) | def get_out_ch(self):
method get_link (line 97) | def get_link(self, layer, base_ch, growth_rate, grmul):
method forward (line 120) | def forward(self, x):
class HarDNet (line 146) | class HarDNet(nn.Layer):
method __init__ (line 147) | def __init__(self, depth_wise=False, return_idx=[1, 3, 8, 13], arch=85):
method forward (line 215) | def forward(self, inputs):
method out_shape (line 225) | def out_shape(self):
FILE: ppdet/modeling/backbones/hgnet_v2.py
class LearnableAffineBlock (line 35) | class LearnableAffineBlock(nn.Layer):
method __init__ (line 36) | def __init__(self,
method forward (line 53) | def forward(self, x):
class ConvBNAct (line 57) | class ConvBNAct(nn.Layer):
method __init__ (line 58) | def __init__(self,
method forward (line 92) | def forward(self, x):
class LightConvBNAct (line 102) | class LightConvBNAct(nn.Layer):
method __init__ (line 103) | def __init__(self,
method forward (line 128) | def forward(self, x):
class StemBlock (line 134) | class StemBlock(nn.Layer):
method __init__ (line 135) | def __init__(self,
method forward (line 182) | def forward(self, x):
class HG_Block (line 194) | class HG_Block(nn.Layer):
method __init__ (line 195) | def __init__(self,
method forward (line 236) | def forward(self, x):
class HG_Stage (line 251) | class HG_Stage(nn.Layer):
method __init__ (line 252) | def __init__(self,
method forward (line 291) | def forward(self, x):
function _freeze_norm (line 298) | def _freeze_norm(m: nn.BatchNorm2D):
function reset_bn (line 314) | def reset_bn(model: nn.Layer, reset_func=_freeze_norm):
class PPHGNetV2 (line 327) | class PPHGNetV2(nn.Layer):
method __init__ (line 392) | def __init__(self,
method _freeze_parameters (line 447) | def _freeze_parameters(self, m):
method _init_weights (line 451) | def _init_weights(self):
method out_shape (line 462) | def out_shape(self):
method forward (line 469) | def forward(self, inputs):
FILE: ppdet/modeling/backbones/hrnet.py
class ConvNormLayer (line 31) | class ConvNormLayer(nn.Layer):
method __init__ (line 32) | def __init__(self,
method forward (line 85) | def forward(self, inputs):
class Layer1 (line 94) | class Layer1(nn.Layer):
method __init__ (line 95) | def __init__(self,
method forward (line 121) | def forward(self, input):
class TransitionLayer (line 128) | class TransitionLayer(nn.Layer):
method __init__ (line 129) | def __init__(self,
method forward (line 172) | def forward(self, input):
class Branches (line 185) | class Branches(nn.Layer):
method __init__ (line 186) | def __init__(self,
method forward (line 215) | def forward(self, inputs):
class BottleneckBlock (line 226) | class BottleneckBlock(nn.Layer):
method __init__ (line 227) | def __init__(self,
method forward (line 289) | def forward(self, input):
class BasicBlock (line 306) | class BasicBlock(nn.Layer):
method __init__ (line 307) | def __init__(self,
method forward (line 360) | def forward(self, input):
class SELayer (line 376) | class SELayer(nn.Layer):
method __init__ (line 377) | def __init__(self, num_channels, num_filters, reduction_ratio, name=No...
method forward (line 397) | def forward(self, input):
class Stage (line 409) | class Stage(nn.Layer):
method __init__ (line 410) | def __init__(self,
method forward (line 451) | def forward(self, input):
class HighResolutionModule (line 458) | class HighResolutionModule(nn.Layer):
method __init__ (line 459) | def __init__(self,
method forward (line 488) | def forward(self, input):
class FuseLayers (line 494) | class FuseLayers(nn.Layer):
method __init__ (line 495) | def __init__(self,
method forward (line 564) | def forward(self, input):
class HRNet (line 588) | class HRNet(nn.Layer):
method __init__ (line 603) | def __init__(self,
method _make_layer (line 730) | def _make_layer(self,
method _make_head (line 767) | def _make_head(self, pre_stage_channels, norm_momentum=0.9, has_se=Fal...
method forward (line 820) | def forward(self, inputs):
method out_shape (line 862) | def out_shape(self):
FILE: ppdet/modeling/backbones/lcnet.py
function make_divisible (line 56) | def make_divisible(v, divisor=8, min_value=None):
class ConvBNLayer (line 65) | class ConvBNLayer(nn.Layer):
method __init__ (line 66) | def __init__(self,
method forward (line 94) | def forward(self, x):
class DepthwiseSeparable (line 101) | class DepthwiseSeparable(nn.Layer):
method __init__ (line 102) | def __init__(self,
method forward (line 127) | def forward(self, x):
class AdaptiveAvgPool2D (line 134) | class AdaptiveAvgPool2D(nn.AdaptiveAvgPool2D):
method __init__ (line 135) | def __init__(self, *args, **kwargs):
method forward (line 151) | def forward(self, x):
class SEModule (line 161) | class SEModule(nn.Layer):
method __init__ (line 162) | def __init__(self, channel, reduction=4):
method forward (line 180) | def forward(self, x):
class LCNet (line 193) | class LCNet(nn.Layer):
method __init__ (line 194) | def __init__(self, scale=1.0, feature_maps=[3, 4, 5], act='hard_swish'):
method forward (line 278) | def forward(self, inputs):
method out_shape (line 296) | def out_shape(self):
FILE: ppdet/modeling/backbones/lite_hrnet.py
class ConvNormLayer (line 35) | class ConvNormLayer(nn.Layer):
method __init__ (line 36) | def __init__(self,
method forward (line 92) | def forward(self, inputs):
class DepthWiseSeparableConvNormLayer (line 104) | class DepthWiseSeparableConvNormLayer(nn.Layer):
method __init__ (line 105) | def __init__(self,
method forward (line 137) | def forward(self, x):
class CrossResolutionWeightingModule (line 143) | class CrossResolutionWeightingModule(nn.Layer):
method __init__ (line 144) | def __init__(self,
method forward (line 172) | def forward(self, x):
class SpatialWeightingModule (line 186) | class SpatialWeightingModule(nn.Layer):
method __init__ (line 187) | def __init__(self, in_channel, ratio=16, freeze_norm=False, norm_decay...
method forward (line 207) | def forward(self, x):
class ConditionalChannelWeightingBlock (line 214) | class ConditionalChannelWeightingBlock(nn.Layer):
method __init__ (line 215) | def __init__(self,
method forward (line 252) | def forward(self, x):
class ShuffleUnit (line 266) | class ShuffleUnit(nn.Layer):
method __init__ (line 267) | def __init__(self,
method forward (line 329) | def forward(self, x):
class IterativeHead (line 341) | class IterativeHead(nn.Layer):
method __init__ (line 342) | def __init__(self,
method forward (line 381) | def forward(self, x):
class Stem (line 400) | class Stem(nn.Layer):
method __init__ (line 401) | def __init__(self,
method forward (line 473) | def forward(self, x):
class LiteHRNetModule (line 486) | class LiteHRNetModule(nn.Layer):
method __init__ (line 487) | def __init__(self,
method _make_weighting_blocks (line 529) | def _make_weighting_blocks(self,
method _make_naive_branches (line 547) | def _make_naive_branches(self,
method _make_fuse_layers (line 567) | def _make_fuse_layers(self, freeze_norm=False, norm_decay=0.):
method forward (line 640) | def forward(self, x):
class LiteHRNet (line 670) | class LiteHRNet(nn.Layer):
method __init__ (line 689) | def __init__(self,
method _make_transition_layer (line 759) | def _make_transition_layer(self,
method _make_stage (line 822) | def _make_stage(self,
method forward (line 855) | def forward(self, inputs):
method out_shape (line 886) | def out_shape(self):
FILE: ppdet/modeling/backbones/mobilenet_v1.py
class ConvBNLayer (line 31) | class ConvBNLayer(nn.Layer):
method __init__ (line 32) | def __init__(self,
method forward (line 66) | def forward(self, x):
class DepthwiseSeparable (line 76) | class DepthwiseSeparable(nn.Layer):
method __init__ (line 77) | def __init__(self,
method forward (line 116) | def forward(self, x):
class ExtraBlock (line 122) | class ExtraBlock(nn.Layer):
method __init__ (line 123) | def __init__(self,
method forward (line 164) | def forward(self, x):
class MobileNet (line 172) | class MobileNet(nn.Layer):
method __init__ (line 175) | def __init__(self,
method _update_out_channels (line 377) | def _update_out_channels(self, channel, feature_idx, feature_maps):
method forward (line 381) | def forward(self, inputs):
method out_shape (line 401) | def out_shape(self):
FILE: ppdet/modeling/backbones/mobilenet_v3.py
function make_divisible (line 31) | def make_divisible(v, divisor=8, min_value=None):
class ConvBNLayer (line 40) | class ConvBNLayer(nn.Layer):
method __init__ (line 41) | def __init__(self,
method forward (line 89) | def forward(self, x):
class ResidualUnit (line 105) | class ResidualUnit(nn.Layer):
method __init__ (line 106) | def __init__(self,
method forward (line 170) | def forward(self, inputs):
class SEModule (line 184) | class SEModule(nn.Layer):
method __init__ (line 185) | def __init__(self, channel, lr_mult, conv_decay, reduction=4, name=""):
method forward (line 210) | def forward(self, inputs):
class ExtraBlockDW (line 219) | class ExtraBlockDW(nn.Layer):
method __init__ (line 220) | def __init__(self,
method forward (line 273) | def forward(self, inputs):
class MobileNetV3 (line 282) | class MobileNetV3(nn.Layer):
method __init__ (line 285) | def __init__(
method _update_out_channels (line 450) | def _update_out_channels(self, channel, feature_idx, feature_maps):
method forward (line 454) | def forward(self, inputs):
method out_shape (line 477) | def out_shape(self):
FILE: ppdet/modeling/backbones/mobileone.py
class MobileOneBlock (line 31) | class MobileOneBlock(nn.Layer):
method __init__ (line 32) | def __init__(
method forward (line 118) | def forward(self, x):
method convert_to_deploy (line 146) | def convert_to_deploy(self):
method get_equivalent_kernel_bias (line 182) | def get_equivalent_kernel_bias(self):
method _pad_1x1_to_3x3_tensor (line 202) | def _pad_1x1_to_3x3_tensor(self, kernel1x1):
method _fuse_bn_tensor (line 211) | def _fuse_bn_tensor(self, branch, kernel_size=3):
FILE: ppdet/modeling/backbones/name_adapter.py
class NameAdapter (line 1) | class NameAdapter(object):
method __init__ (line 4) | def __init__(self, model):
method model_type (line 9) | def model_type(self):
method variant (line 13) | def variant(self):
method fix_conv_norm_name (line 16) | def fix_conv_norm_name(self, name):
method fix_shortcut_name (line 26) | def fix_shortcut_name(self, name):
method fix_bottleneck_name (line 31) | def fix_bottleneck_name(self, name):
method fix_basicblock_name (line 44) | def fix_basicblock_name(self, name):
method fix_layer_warp_name (line 55) | def fix_layer_warp_name(self, stage_num, count, i):
method fix_c1_stage_name (line 68) | def fix_c1_stage_name(self):
FILE: ppdet/modeling/backbones/res2net.py
class BottleNeck (line 34) | class BottleNeck(nn.Layer):
method __init__ (line 35) | def __init__(self,
method forward (line 121) | def forward(self, inputs):
class Blocks (line 149) | class Blocks(nn.Layer):
method __init__ (line 150) | def __init__(self,
method forward (line 185) | def forward(self, inputs):
class Res2Net (line 191) | class Res2Net(nn.Layer):
method __init__ (line 215) | def __init__(self,
method out_shape (line 313) | def out_shape(self):
method forward (line 320) | def forward(self, inputs):
class Res2NetC5 (line 335) | class Res2NetC5(nn.Layer):
method __init__ (line 336) | def __init__(self, depth=50, width=26, scales=4, variant='b'):
method out_shape (line 350) | def out_shape(self):
method forward (line 355) | def forward(self, roi_feat, stage=0):
FILE: ppdet/modeling/backbones/resnet.py
class ConvNormLayer (line 41) | class ConvNormLayer(nn.Layer):
method __init__ (line 42) | def __init__(self,
method forward (line 116) | def forward(self, inputs):
class SELayer (line 135) | class SELayer(nn.Layer):
method __init__ (line 136) | def __init__(self, ch, reduction_ratio=16):
method forward (line 154) | def forward(self, inputs):
class BasicBlock (line 166) | class BasicBlock(nn.Layer):
method __init__ (line 170) | def __init__(self,
method forward (line 244) | def forward(self, inputs):
class BottleNeck (line 261) | class BottleNeck(nn.Layer):
method __init__ (line 265) | def __init__(self,
method forward (line 358) | def forward(self, inputs):
class Blocks (line 378) | class Blocks(nn.Layer):
method __init__ (line 379) | def __init__(self,
method forward (line 420) | def forward(self, inputs):
class ResNet (line 429) | class ResNet(nn.Layer):
method __init__ (line 432) | def __init__(self,
method _freeze_parameters (line 566) | def _freeze_parameters(self, m):
method out_shape (line 571) | def out_shape(self):
method forward (line 578) | def forward(self, inputs):
class Res5Head (line 591) | class Res5Head(nn.Layer):
method __init__ (line 592) | def __init__(self, depth=50):
method out_shape (line 604) | def out_shape(self):
method forward (line 609) | def forward(self, roi_feat, stage=0):
FILE: ppdet/modeling/backbones/senet.py
class SENet (line 27) | class SENet(ResNet):
method __init__ (line 30) | def __init__(self,
class SERes5Head (line 83) | class SERes5Head(nn.Layer):
method __init__ (line 84) | def __init__(self,
method out_shape (line 134) | def out_shape(self):
method forward (line 139) | def forward(self, roi_feat):
FILE: ppdet/modeling/backbones/shufflenet_v2.py
class ConvBNLayer (line 35) | class ConvBNLayer(nn.Layer):
method __init__ (line 36) | def __init__(self,
method forward (line 63) | def forward(self, inputs):
class InvertedResidual (line 71) | class InvertedResidual(nn.Layer):
method __init__ (line 72) | def __init__(self, in_channels, out_channels, stride, act="relu"):
method forward (line 99) | def forward(self, inputs):
class InvertedResidualDS (line 111) | class InvertedResidualDS(nn.Layer):
method __init__ (line 112) | def __init__(self, in_channels, out_channels, stride, act="relu"):
method forward (line 158) | def forward(self, inputs):
class ShuffleNetV2 (line 171) | class ShuffleNetV2(nn.Layer):
method __init__ (line 172) | def __init__(self, scale=1.0, act="relu", feature_maps=[5, 13, 17]):
method _update_out_channels (line 233) | def _update_out_channels(self, channel, feature_idx, feature_maps):
method forward (line 237) | def forward(self, inputs):
method out_shape (line 249) | def out_shape(self):
FILE: ppdet/modeling/backbones/swin_transformer.py
class Mlp (line 84) | class Mlp(nn.Layer):
method __init__ (line 85) | def __init__(self,
method forward (line 99) | def forward(self, x):
function window_partition (line 108) | def window_partition(x, window_size):
function window_reverse (line 124) | def window_reverse(windows, window_size, H, W):
class WindowAttention (line 142) | class WindowAttention(nn.Layer):
method __init__ (line 156) | def __init__(self,
method forward (line 203) | def forward(self, x, mask=None):
class SwinTransformerBlock (line 248) | class SwinTransformerBlock(nn.Layer):
method __init__ (line 265) | def __init__(self,
method forward (line 307) | def forward(self, x, mask_matrix):
class PatchMerging (line 377) | class PatchMerging(nn.Layer):
method __init__ (line 384) | def __init__(self, dim, norm_layer=nn.LayerNorm):
method forward (line 390) | def forward(self, x, H, W):
class BasicLayer (line 422) | class BasicLayer(nn.Layer):
method __init__ (line 439) | def __init__(self,
method forward (line 480) | def forward(self, x, H, W):
class PatchEmbed (line 523) | class PatchEmbed(nn.Layer):
method __init__ (line 532) | def __init__(self, patch_size=4, in_chans=3, embed_dim=96, norm_layer=...
method forward (line 547) | def forward(self, x):
class SwinTransformer (line 568) | class SwinTransformer(nn.Layer):
method __init__ (line 590) | def __init__(self,
method _freeze_stages (line 694) | def _freeze_stages(self):
method _init_weights (line 711) | def _init_weights(self, m):
method forward (line 720) | def forward(self, x):
method out_shape (line 746) | def out_shape(self):
FILE: ppdet/modeling/backbones/trans_encoder.py
class BertEmbeddings (line 27) | class BertEmbeddings(nn.Layer):
method __init__ (line 28) | def __init__(self, word_size, position_embeddings_size, word_type_size,
method forward (line 39) | def forward(self, x, token_type_ids=None, position_ids=None):
class BertSelfAttention (line 56) | class BertSelfAttention(nn.Layer):
method __init__ (line 57) | def __init__(self,
method forward (line 80) | def forward(self, x, attention_mask, head_mask=None):
class BertAttention (line 119) | class BertAttention(nn.Layer):
method __init__ (line 120) | def __init__(self,
method forward (line 134) | def forward(self, x, attention_mask, head_mask=None):
class BertFeedForward (line 145) | class BertFeedForward(nn.Layer):
method __init__ (line 146) | def __init__(self,
method forward (line 161) | def forward(self, x):
class BertLayer (line 170) | class BertLayer(nn.Layer):
method __init__ (line 171) | def __init__(self,
method forward (line 188) | def forward(self, x, attention_mask, head_mask=None):
class BertEncoder (line 197) | class BertEncoder(nn.Layer):
method __init__ (line 198) | def __init__(self,
method forward (line 217) | def forward(self, x, attention_mask, head_mask=None):
class BertPooler (line 239) | class BertPooler(nn.Layer):
method __init__ (line 240) | def __init__(self, hidden_size):
method forward (line 245) | def forward(self, x):
class METROEncoder (line 252) | class METROEncoder(nn.Layer):
method __init__ (line 253) | def __init__(self,
method init_weights (line 290) | def init_weights(self, module):
method forward (line 305) | def forward(self, x):
function gelu (line 338) | def gelu(x):
class TransEncoder (line 346) | class TransEncoder(nn.Layer):
method __init__ (line 347) | def __init__(self,
method forward (line 379) | def forward(self, x):
FILE: ppdet/modeling/backbones/transformer_utils.py
function drop_path (line 28) | def drop_path(x, drop_prob=0., training=False):
class DropPath (line 44) | class DropPath(nn.Layer):
method __init__ (line 45) | def __init__(self, drop_prob=None):
method forward (line 49) | def forward(self, x):
class Identity (line 53) | class Identity(nn.Layer):
method __init__ (line 54) | def __init__(self):
method forward (line 57) | def forward(self, input):
function to_2tuple (line 64) | def to_2tuple(x):
function add_parameter (line 70) | def add_parameter(layer, datas, name=None):
function window_partition (line 78) | def window_partition(x, window_size):
function window_unpartition (line 106) | def window_unpartition(x, pad_hw, num_hw, hw):
FILE: ppdet/modeling/backbones/vgg.py
class ConvBlock (line 16) | class ConvBlock(nn.Layer):
method __init__ (line 17) | def __init__(self,
method forward (line 52) | def forward(self, inputs):
class ExtraBlock (line 62) | class ExtraBlock(nn.Layer):
method __init__ (line 63) | def __init__(self,
method forward (line 86) | def forward(self, inputs):
class L2NormScale (line 94) | class L2NormScale(nn.Layer):
method __init__ (line 95) | def __init__(self, num_channels, scale=1.0):
method forward (line 101) | def forward(self, inputs):
class VGG (line 111) | class VGG(nn.Layer):
method __init__ (line 112) | def __init__(self,
method forward (line 178) | def forward(self, inputs):
method out_shape (line 209) | def out_shape(self):
FILE: ppdet/modeling/backbones/vision_transformer.py
class Mlp (line 28) | class Mlp(nn.Layer):
method __init__ (line 29) | def __init__(self,
method forward (line 43) | def forward(self, x):
class Attention (line 52) | class Attention(nn.Layer):
method __init__ (line 53) | def __init__(self,
method forward (line 123) | def forward(self, x, rel_pos_bias=None):
class Block (line 159) | class Block(nn.Layer):
method __init__ (line 160) | def __init__(self,
method forward (line 200) | def forward(self, x, rel_pos_bias=None):
class PatchEmbed (line 214) | class PatchEmbed(nn.Layer):
method __init__ (line 218) | def __init__(self,
method num_patches_in_h (line 238) | def num_patches_in_h(self):
method num_patches_in_w (line 242) | def num_patches_in_w(self):
method forward (line 245) | def forward(self, x, mask=None):
class RelativePositionBias (line 250) | class RelativePositionBias(nn.Layer):
method __init__ (line 251) | def __init__(self, window_size, num_heads):
method forward (line 285) | def forward(self):
function get_sinusoid_encoding_table (line 293) | def get_sinusoid_encoding_table(n_position, d_hid, token=False):
class VisionTransformer (line 315) | class VisionTransformer(nn.Layer):
method __init__ (line 319) | def __init__(self,
method init_weight (line 434) | def init_weight(self):
method init_fpn (line 467) | def init_fpn(self, embed_dim=768, patch_size=16, out_with_norm=False):
method interpolate_pos_encoding (line 500) | def interpolate_pos_encoding(self, x, w, h):
method resize_pos_embed (line 537) | def resize_pos_embed(self, pos_embed, old_hw, new_hw):
method build_2d_sincos_position_embedding (line 559) | def build_2d_sincos_position_embedding(
method forward (line 588) | def forward(self, x):
method num_layers (line 639) | def num_layers(self):
method no_weight_decay (line 643) | def no_weight_decay(self):
method out_shape (line 647) | def out_shape(self):
FILE: ppdet/modeling/backbones/vit_mae.py
class Mlp (line 33) | class Mlp(nn.Layer):
method __init__ (line 34) | def __init__(self,
method _init_weights (line 59) | def _init_weights(self):
method forward (line 63) | def forward(self, x):
class Attention (line 69) | class Attention(nn.Layer):
method __init__ (line 70) | def __init__(self,
method _init_weights (line 118) | def _init_weights(self):
method get_rel_pos (line 136) | def get_rel_pos(self, seq_size, rel_pos):
method add_decomposed_rel_pos (line 161) | def add_decomposed_rel_pos(self, attn, q, h, w):
method forward (line 183) | def forward(self, x):
class Block (line 211) | class Block(nn.Layer):
method __init__ (line 212) | def __init__(self,
method forward (line 278) | def forward(self, x):
class PatchEmbed (line 297) | class PatchEmbed(nn.Layer):
method __init__ (line 301) | def __init__(self,
method num_patches_in_h (line 319) | def num_patches_in_h(self):
method num_patches_in_w (line 323) | def num_patches_in_w(self):
method forward (line 326) | def forward(self, x):
class VisionTransformer2D (line 333) | class VisionTransformer2D(nn.Layer):
method __init__ (line 337) | def __init__(self,
method get_vit_lr_decay_rate (line 454) | def get_vit_lr_decay_rate(self, layer_id, lr_decay_rate):
method init_weight (line 457) | def init_weight(self):
method init_fpn (line 490) | def init_fpn(self, embed_dim=768, patch_size=16, out_with_norm=False):
method resize_pos_embed (line 523) | def resize_pos_embed(self, pos_embed, old_hw, new_hw):
method get_2d_sincos_position_embedding (line 545) | def get_2d_sincos_position_embedding(self, h, w, temperature=10000.):
method forward (line 568) | def forward(self, inputs):
method num_layers (line 596) | def num_layers(self):
method no_weight_decay (line 600) | def no_weight_decay(self):
method out_shape (line 604) | def out_shape(self):
class LayerNorm (line 612) | class LayerNorm(nn.Layer):
method __init__ (line 622) | def __init__(self, normalized_shape, eps=1e-6):
method forward (line 629) | def forward(self, x):
class SimpleFeaturePyramid (line 639) | class SimpleFeaturePyramid(nn.Layer):
method __init__ (line 640) | def __init__(self,
method from_config (line 721) | def from_config(cls, cfg, input_shape):
method out_shape (line 728) | def out_shape(self):
method forward (line 734) | def forward(self, feats):
FILE: ppdet/modeling/backbones/vitpose.py
function to_2tuple (line 29) | def to_2tuple(x):
function drop_path (line 35) | def drop_path(x, drop_prob=0., training=False):
class DropPath (line 50) | class DropPath(nn.Layer):
method __init__ (line 54) | def __init__(self, drop_prob=None):
method forward (line 58) | def forward(self, x):
class Identity (line 62) | class Identity(nn.Layer):
method __init__ (line 63) | def __init__(self):
method forward (line 66) | def forward(self, input):
class Mlp (line 70) | class Mlp(nn.Layer):
method __init__ (line 71) | def __init__(self,
method forward (line 85) | def forward(self, x):
class Attention (line 94) | class Attention(nn.Layer):
method __init__ (line 95) | def __init__(self,
method forward (line 113) | def forward(self, x):
class Block (line 132) | class Block(nn.Layer):
method __init__ (line 133) | def __init__(self,
method forward (line 175) | def forward(self, x):
class PatchEmbed (line 182) | class PatchEmbed(nn.Layer):
method __init__ (line 186) | def __init__(self,
method forward (line 209) | def forward(self, x):
class ViT (line 220) | class ViT(nn.Layer):
method __init__ (line 233) | def __init__(self,
method _init_weights (line 289) | def _init_weights(self):
method forward_features (line 304) | def forward_features(self, x):
FILE: ppdet/modeling/bbox_utils.py
function bbox2delta (line 20) | def bbox2delta(src_boxes, tgt_boxes, weights=[1.0, 1.0, 1.0, 1.0]):
function delta2bbox (line 43) | def delta2bbox(deltas, boxes, weights=[1.0, 1.0, 1.0, 1.0], max_shape=No...
function bbox2delta_v2 (line 84) | def bbox2delta_v2(src_boxes,
function delta2bbox_v2 (line 112) | def delta2bbox_v2(deltas,
function expand_bbox (line 169) | def expand_bbox(bboxes, scale):
function clip_bbox (line 187) | def clip_bbox(boxes, im_shape):
function nonempty_bbox (line 196) | def nonempty_bbox(boxes, min_size=0, return_mask=False):
function bbox_area (line 206) | def bbox_area(boxes):
function bbox_overlaps (line 210) | def bbox_overlaps(boxes1, boxes2):
function batch_bbox_overlaps (line 242) | def batch_bbox_overlaps(bboxes1,
function xywh2xyxy (line 336) | def xywh2xyxy(box):
function make_grid (line 345) | def make_grid(h, w, dtype):
function decode_yolo (line 350) | def decode_yolo(box, anchor, downsample_ratio):
function batch_iou_similarity (line 376) | def batch_iou_similarity(box1, box2, eps=1e-9):
function bbox_iou (line 399) | def bbox_iou(box1, box2, giou=False, diou=False, ciou=False, eps=1e-9):
function bbox_iou_np_expand (line 457) | def bbox_iou_np_expand(box1, box2, x1y1x2y2=True, eps=1e-16):
function bbox2distance (line 506) | def bbox2distance(points, bbox, max_dis=None, eps=0.1):
function distance2bbox (line 528) | def distance2bbox(points, distance, max_shape=None):
function bbox_center (line 550) | def bbox_center(boxes):
function batch_distance2bbox (line 562) | def batch_distance2bbox(points, distance, max_shapes=None):
function iou_similarity (line 587) | def iou_similarity(box1, box2, eps=1e-10):
FILE: ppdet/modeling/clrnet_utils.py
class ConvModule (line 8) | class ConvModule(nn.Layer):
method __init__ (line 9) | def __init__(self,
method forward (line 43) | def forward(self, inputs):
function LinearModule (line 52) | def LinearModule(hidden_dim):
class FeatureResize (line 58) | class FeatureResize(nn.Layer):
method __init__ (line 59) | def __init__(self, size=(10, 25)):
method forward (line 63) | def forward(self, x):
class ROIGather (line 68) | class ROIGather(nn.Layer):
method __init__ (line 79) | def __init__(self,
method roi_fea (line 148) | def roi_fea(self, x, layer_index):
method forward (line 157) | def forward(self, roi_features, x, layer_index):
class SegDecoder (line 205) | class SegDecoder(nn.Layer):
method __init__ (line 210) | def __init__(self,
method forward (line 222) | def forward(self, x):
function accuracy (line 236) | def accuracy(pred, target, topk=1, thresh=None):
class Accuracy (line 285) | class Accuracy(nn.Layer):
method __init__ (line 286) | def __init__(self, topk=(1, ), thresh=None):
method forward (line 299) | def forward(self, pred, target):
FILE: ppdet/modeling/cls_utils.py
function _get_class_default_kwargs (line 16) | def _get_class_default_kwargs(cls, *args, **kwargs):
FILE: ppdet/modeling/heads/bbox_head.py
class TwoFCHead (line 34) | class TwoFCHead(nn.Layer):
method __init__ (line 44) | def __init__(self, in_channel=256, out_channel=1024, resolution=7):
method from_config (line 63) | def from_config(cls, cfg, input_shape):
method out_shape (line 69) | def out_shape(self):
method forward (line 72) | def forward(self, rois_feat):
class XConvNormHead (line 82) | class XConvNormHead(nn.Layer):
method __init__ (line 99) | def __init__(self,
method from_config (line 144) | def from_config(cls, cfg, input_shape):
method out_shape (line 150) | def out_shape(self):
method forward (line 153) | def forward(self, rois_feat):
class BBoxHead (line 162) | class BBoxHead(nn.Layer):
method __init__ (line 182) | def __init__(self,
method init_cot_head (line 242) | def init_cot_head(self, relationship):
method from_config (line 246) | def from_config(cls, cfg, input_shape):
method forward (line 259) | def forward(self, body_feats=None, rois=None, rois_num=None, inputs=No...
method get_loss (line 306) | def get_loss(self,
method bbox_transform (line 403) | def bbox_transform(self, deltas, weights=[0.1, 0.1, 0.2, 0.2]):
method get_prediction (line 433) | def get_prediction(self, score, delta):
method get_head (line 437) | def get_head(self, ):
method get_assigned_targets (line 440) | def get_assigned_targets(self, ):
method get_assigned_rois (line 443) | def get_assigned_rois(self, ):
FILE: ppdet/modeling/heads/cascade_head.py
class CascadeTwoFCHead (line 31) | class CascadeTwoFCHead(nn.Layer):
method __init__ (line 43) | def __init__(self,
method from_config (line 60) | def from_config(cls, cfg, input_shape):
method out_shape (line 66) | def out_shape(self):
method forward (line 69) | def forward(self, rois_feat, stage=0):
class CascadeXConvNormHead (line 75) | class CascadeXConvNormHead(nn.Layer):
method __init__ (line 92) | def __init__(self,
method from_config (line 121) | def from_config(cls, cfg, input_shape):
method out_shape (line 127) | def out_shape(self):
method forward (line 130) | def forward(self, rois_feat, stage=0):
class CascadeHead (line 136) | class CascadeHead(BBoxHead):
method __init__ (line 154) | def __init__(self,
method forward (line 218) | def forward(self, body_feats=None, rois=None, rois_num=None, inputs=No...
method _get_rois_from_boxes (line 294) | def _get_rois_from_boxes(self, boxes, im_shape):
method _get_pred_bbox (line 307) | def _get_pred_bbox(self, deltas, proposals, weights):
method get_prediction (line 325) | def get_prediction(self, head_out_list):
method get_refined_rois (line 336) | def get_refined_rois(self, ):
FILE: ppdet/modeling/heads/centernet_head.py
class ConvLayer (line 24) | class ConvLayer(nn.Layer):
method __init__ (line 25) | def __init__(self,
method forward (line 52) | def forward(self, inputs):
class CenterNetHead (line 58) | class CenterNetHead(nn.Layer):
method __init__ (line 74) | def __init__(self,
method from_config (line 149) | def from_config(cls, cfg, input_shape):
method forward (line 154) | def forward(self, feat, inputs):
method get_loss (line 169) | def get_loss(self, inputs, weights, head_outs):
FILE: ppdet/modeling/heads/centertrack_head.py
class CenterTrackHead (line 27) | class CenterTrackHead(nn.Layer):
method __init__ (line 40) | def __init__(self,
method from_config (line 84) | def from_config(cls, cfg, input_shape):
method forward (line 89) | def forward(self,
method get_loss (line 111) | def get_loss(self, inputs, weights, head_outs):
method generic_decode (line 167) | def generic_decode(self, head_outs, bboxes, bbox_inds, topk_ys, topk_xs):
method centertrack_post_process (line 195) | def centertrack_post_process(self, dets, meta, out_thresh):
function transform_preds_with_trans (line 233) | def transform_preds_with_trans(coords, trans):
function _tranpose_and_gather_feat (line 240) | def _tranpose_and_gather_feat(feat, bbox_inds):
FILE: ppdet/modeling/heads/clrnet_head.py
class CLRHead (line 17) | class CLRHead(nn.Layer):
method __init__ (line 24) | def __init__(self,
method init_weights (line 98) | def init_weights(self):
method pool_prior_features (line 104) | def pool_prior_features(self, batch_features, num_priors, prior_xs):
method generate_priors_from_embeddings (line 128) | def generate_priors_from_embeddings(self):
method _init_prior_embeddings (line 146) | def _init_prior_embeddings(self):
method forward (line 175) | def forward(self, x, inputs=None):
method predictions_to_pred (line 271) | def predictions_to_pred(self, predictions):
method lane_nms (line 317) | def lane_nms(self, predictions, scores, nms_overlap_thresh, top_k):
method get_lanes (line 357) | def get_lanes(self, output, as_lanes=True):
FILE: ppdet/modeling/heads/detr_head.py
class MLP (line 30) | class MLP(nn.Layer):
method __init__ (line 35) | def __init__(self, input_dim, hidden_dim, output_dim, num_layers):
method _reset_parameters (line 44) | def _reset_parameters(self):
method forward (line 48) | def forward(self, x):
class MultiHeadAttentionMap (line 54) | class MultiHeadAttentionMap(nn.Layer):
method __init__ (line 61) | def __init__(self, query_dim, hidden_dim, num_heads, dropout=0.0,
method forward (line 83) | def forward(self, q, k, mask=None):
class MaskHeadFPNConv (line 104) | class MaskHeadFPNConv(nn.Layer):
method __init__ (line 112) | def __init__(self, input_dim, fpn_dims, context_dim, num_groups=8):
method _make_layers (line 148) | def _make_layers(self,
method forward (line 166) | def forward(self, x, bbox_attention_map, fpns):
class DETRHead (line 185) | class DETRHead(nn.Layer):
method __init__ (line 189) | def __init__(self,
method _reset_parameters (line 218) | def _reset_parameters(self):
method from_config (line 222) | def from_config(cls, cfg, hidden_dim, nhead, input_shape):
method get_gt_mask_from_polygons (line 231) | def get_gt_mask_from_polygons(gt_poly, pad_mask):
method forward (line 248) | def forward(self, out_transformer, body_feats, inputs=None):
class DeformableDETRHead (line 292) | class DeformableDETRHead(nn.Layer):
method __init__ (line 296) | def __init__(self,
method _reset_parameters (line 316) | def _reset_parameters(self):
method from_config (line 327) | def from_config(cls, cfg, hidden_dim, nhead, input_shape):
method forward (line 330) | def forward(self, out_transformer, body_feats, inputs=None):
class DINOHead (line 368) | class DINOHead(nn.Layer):
method __init__ (line 371) | def __init__(self, loss='DINOLoss', eval_idx=-1):
method forward (line 376) | def forward(self, out_transformer, body_feats, inputs=None):
class MaskDINOHead (line 468) | class MaskDINOHead(nn.Layer):
method __init__ (line 471) | def __init__(self, loss='DINOLoss'):
method forward (line 475) | def forward(self, out_transformer, body_feats, inputs=None):
class DINOv3Head (line 542) | class DINOv3Head(nn.Layer):
method __init__ (line 547) | def __init__(self, loss='DINOLoss', eval_idx=-1, o2m=4, o2m_branch=Fal...
method forward (line 555) | def forward(self, out_transformer, body_feats, inputs=None):
FILE: ppdet/modeling/heads/face_head.py
class FaceHead (line 24) | class FaceHead(nn.Layer):
method __init__ (line 40) | def __init__(self,
method from_config (line 83) | def from_config(cls, cfg, input_shape):
method forward (line 86) | def forward(self, feats, image, gt_bbox=None, gt_class=None):
method get_loss (line 110) | def get_loss(self, boxes, scores, gt_bbox, gt_class, prior_boxes):
FILE: ppdet/modeling/heads/fcos_head.py
class ScaleReg (line 32) | class ScaleReg(nn.Layer):
method __init__ (line 37) | def __init__(self):
method forward (line 44) | def forward(self, inputs):
class FCOSFeat (line 50) | class FCOSFeat(nn.Layer):
method __init__ (line 62) | def __init__(self,
method forward (line 106) | def forward(self, fpn_feat):
class FCOSHead (line 116) | class FCOSHead(nn.Layer):
method __init__ (line 134) | def __init__(self,
method _compute_locations_by_level (line 211) | def _compute_locations_by_level(self, fpn_stride, feature, num_shift=0...
method forward (line 234) | def forward(self, fpn_feats, targets=None):
method get_loss (line 297) | def get_loss(self, fcos_head_outs, targets):
method _post_process_by_level (line 317) | def _post_process_by_level(self,
method post_process (line 342) | def post_process(self, fcos_head_outs, scale_factor):
class FCOSHead_ARSL (line 367) | class FCOSHead_ARSL(FCOSHead):
method __init__ (line 384) | def __init__(self,
method forward (line 460) | def forward(self, fpn_feats, targets=None):
method get_loss (line 496) | def get_loss(self, fcos_head_outs, tag_labels, tag_bboxes, tag_centern...
FILE: ppdet/modeling/heads/fcosr_head.py
function trunc_div (line 32) | def trunc_div(a, b):
function fmod (line 41) | def fmod(a, b):
function fmod_eval (line 45) | def fmod_eval(a, b):
class ConvBNLayer (line 49) | class ConvBNLayer(nn.Layer):
method __init__ (line 50) | def __init__(self,
method forward (line 87) | def forward(self, x):
class FCOSRHead (line 96) | class FCOSRHead(nn.Layer):
method __init__ (line 102) | def __init__(self,
method _init_weights (line 170) | def _init_weights(self):
method from_config (line 183) | def from_config(cls, cfg, input_shape):
method _generate_anchors (line 186) | def _generate_anchors(self, feats):
method forward (line 225) | def forward(self, feats, target=None):
method forward_train (line 231) | def forward_train(self, feats, target=None):
method forward_eval (line 262) | def forward_eval(self, feats, target=None):
method _bbox_decode (line 291) | def _bbox_decode(self, points, reg_pred_list):
method _box2corners (line 296) | def _box2corners(self, pred_bboxes):
method get_loss (line 319) | def get_loss(self, head_outs, gt_meta):
method _qfocal_loss (line 375) | def _qfocal_loss(score, label, gamma=2.0, reduction='sum'):
method post_process (line 381) | def post_process(self, head_outs, scale_factor):
FILE: ppdet/modeling/heads/gfl_head.py
class ScaleReg (line 37) | class ScaleReg(nn.Layer):
method __init__ (line 42) | def __init__(self):
method forward (line 49) | def forward(self, inputs):
class Integral (line 54) | class Integral(nn.Layer):
method __init__ (line 65) | def __init__(self, reg_max=16):
method forward (line 71) | def forward(self, x):
class DGQP (line 89) | class DGQP(nn.Layer):
method __init__ (line 97) | def __init__(self, reg_topk=4, reg_channels=64, add_mean=True):
method forward (line 124) | def forward(self, x):
class GFLHead (line 149) | class GFLHead(nn.Layer):
method __init__ (line 168) | def __init__(self,
method forward (line 239) | def forward(self, fpn_feats):
method _images_to_levels (line 276) | def _images_to_levels(self, target, num_level_anchors):
method _grid_cells_to_center (line 288) | def _grid_cells_to_center(self, grid_cells):
method get_loss (line 300) | def get_loss(self, gfl_head_outs, gt_meta):
method get_single_level_center_point (line 413) | def get_single_level_center_point(self, featmap_size, stride,
method post_process (line 431) | def post_process(self, gfl_head_outs, im_shape, scale_factor):
class LDGFLHead (line 444) | class LDGFLHead(GFLHead):
method __init__ (line 464) | def __init__(self,
method forward (line 500) | def forward(self, fpn_feats):
method get_loss (line 538) | def get_loss(self, gfl_head_outs, gt_meta, soft_label_list,
FILE: ppdet/modeling/heads/keypoint_hrhrnet_head.py
class HrHRNetHead (line 24) | class HrHRNetHead(nn.Layer):
method __init__ (line 27) | def __init__(self, num_joints, loss='HrHRNetLoss', swahr=False, width=...
method forward (line 88) | def forward(self, feats, targets=None):
FILE: ppdet/modeling/heads/mask_head.py
class MaskFeat (line 27) | class MaskFeat(nn.Layer):
method __init__ (line 39) | def __init__(self,
method from_config (line 93) | def from_config(cls, cfg, input_shape):
method out_channels (line 98) | def out_channels(self):
method forward (line 101) | def forward(self, feats):
class MaskHead (line 106) | class MaskHead(nn.Layer):
method __init__ (line 122) | def __init__(self,
method from_config (line 151) | def from_config(cls, cfg, input_shape):
method get_loss (line 163) | def get_loss(self, mask_logits, mask_label, mask_target, mask_weight):
method forward_train (line 177) | def forward_train(self, body_feats, rois, rois_num, inputs, targets,
method forward_test (line 200) | def forward_test(self,
method forward (line 236) | def forward(self,
FILE: ppdet/modeling/heads/petr_head.py
function bias_init_with_prob (line 34) | def bias_init_with_prob(prior_prob: float) -> float:
function multi_apply (line 40) | def multi_apply(func, *args, **kwargs):
function reduce_mean (line 63) | def reduce_mean(tensor):
function gaussian_radius (line 76) | def gaussian_radius(det_size, min_overlap=0.7):
function gaussian2D (line 101) | def gaussian2D(shape, sigma=1):
function draw_umich_gaussian (line 112) | def draw_umich_gaussian(heatmap, center, radius, k=1):
class PETRHead (line 136) | class PETRHead(nn.Layer):
method __init__ (line 175) | def __init__(self,
method _init_layers (line 236) | def _init_layers(self):
method init_weights (line 280) | def init_weights(self):
method forward (line 298) | def forward(self, mlvl_feats, img_metas):
method forward_refine (line 389) | def forward_refine(self, memory, mlvl_masks, refine_targets, losses,
method forward_train (line 500) | def forward_train(self,
method loss (line 550) | def loss(self,
method loss_heatmap (line 649) | def loss_heatmap(self, hm_pred, hm_mask, gt_keypoints, gt_labels,
method loss_single (line 691) | def loss_single(self, cls_scores, kpt_preds, gt_labels_list,
method get_targets (line 791) | def get_targets(self, cls_scores_list, kpt_preds_list, gt_labels_list,
method _get_target_single (line 839) | def _get_target_single(self, cls_score, kpt_pred, gt_labels, gt_keypoi...
method loss_single_rpn (line 925) | def loss_single_rpn(self, cls_scores, kpt_preds, gt_labels_list,
method get_bboxes (line 992) | def get_bboxes(self,
method _get_bboxes_single (line 1050) | def _get_bboxes_single(self,
method simple_test (line 1136) | def simple_test(self, feats, img_metas, rescale=False):
method get_loss (line 1160) | def get_loss(self, boxes, scores, gt_bbox, gt_class, prior_boxes):
FILE: ppdet/modeling/heads/pico_head.py
function npu_avg_pool2d (line 42) | def npu_avg_pool2d(feat, w, h):
class PicoSE (line 50) | class PicoSE(nn.Layer):
method __init__ (line 51) | def __init__(self, feat_channels):
method _init_weights (line 58) | def _init_weights(self):
method forward (line 61) | def forward(self, feat, avg_feat):
class PicoFeat (line 68) | class PicoFeat(nn.Layer):
method __init__ (line 82) | def __init__(self,
method act_func (line 167) | def act_func(self, x):
method forward (line 176) | def forward(self, fpn_feat, stage_idx):
class PicoHead (line 196) | class PicoHead(OTAVFLHead):
method __init__ (line 217) | def __init__(self,
method forward (line 310) | def forward(self, fpn_feats, export_post_process=True):
method forward_train (line 321) | def forward_train(self, fpn_feats):
method forward_eval (line 344) | def forward_eval(self, fpn_feats, export_post_process=True):
method _generate_anchors (line 394) | def _generate_anchors(self, feats=None):
method post_process (line 418) | def post_process(self,
class PicoHeadV2 (line 444) | class PicoHeadV2(GFLHead):
method __init__ (line 465) | def __init__(self,
method forward (line 572) | def forward(self, fpn_feats, export_post_process=True):
method forward_train (line 583) | def forward_train(self, fpn_feats):
method forward_eval (line 620) | def forward_eval(self, fpn_feats, export_post_process=True):
method get_loss (line 666) | def get_loss(self, head_outs, gt_meta):
method _generate_anchors (line 773) | def _generate_anchors(self, feats=None):
method post_process (line 797) | def post_process(self,
FILE: ppdet/modeling/heads/ppyoloe_contrast_head.py
class PPYOLOEContrastHead (line 28) | class PPYOLOEContrastHead(PPYOLOEHead):
method __init__ (line 35) | def __init__(self,
method _init_contrast_encoder (line 76) | def _init_contrast_encoder(self):
method forward_train (line 82) | def forward_train(self, feats, targets, aux_pred=None):
method get_loss (line 112) | def get_loss(self, head_outs, gt_meta):
FILE: ppdet/modeling/heads/ppyoloe_head.py
class ESEAttn (line 34) | class ESEAttn(nn.Layer):
method __init__ (line 35) | def __init__(self, feat_channels, act='swish', attn_conv='convbn'):
method _init_weights (line 46) | def _init_weights(self):
method forward (line 49) | def forward(self, feat, avg_feat):
class PPYOLOEHead (line 58) | class PPYOLOEHead(nn.Layer):
method __init__ (line 65) | def __init__(self,
method from_config (line 150) | def from_config(cls, cfg, input_shape):
method _init_weights (line 153) | def _init_weights(self):
method m_avg_pool2d (line 171) | def m_avg_pool2d(self, feat, w, h):
method forward_train (line 179) | def forward_train(self, feats, targets, aux_pred=None):
method _generate_anchors (line 214) | def _generate_anchors(self, feats=None, dtype='float32'):
method forward_eval (line 236) | def forward_eval(self, feats):
method forward (line 273) | def forward(self, feats, targets=None, aux_pred=None):
method _focal_loss (line 291) | def _focal_loss(score, label, alpha=0.25, gamma=2.0):
method _varifocal_loss (line 301) | def _varifocal_loss(pred_score, gt_score, label, alpha=0.75, gamma=2.0):
method _bbox_decode (line 307) | def _bbox_decode(self, anchor_points, pred_dist):
method _bbox_decode_fake (line 313) | def _bbox_decode_fake(self, pred_dist):
method _bbox2distance (line 321) | def _bbox2distance(self, points, bbox):
method _df_loss (line 328) | def _df_loss(self, pred_dist, target, lower_bound=0):
method _bbox_loss (line 341) | def _bbox_loss(self, pred_dist, pred_bboxes, anchor_points, assigned_l...
method get_loss (line 389) | def get_loss(self, head_outs, gt_meta, aux_pred=None):
method get_loss_from_assign (line 488) | def get_loss_from_assign(self, pred_scores, pred_distri, pred_bboxes,
method post_process (line 532) | def post_process(self, head_outs, scale_factor):
function get_activation (line 556) | def get_activation(name="LeakyReLU"):
class ConvNormLayer (line 570) | class ConvNormLayer(nn.Layer):
method __init__ (line 571) | def __init__(self,
method forward (line 603) | def forward(self, x):
class ScaleReg (line 611) | class ScaleReg(nn.Layer):
method __init__ (line 616) | def __init__(self, scale=1.0):
method forward (line 624) | def forward(self, x):
class SimpleConvHead (line 629) | class SimpleConvHead(nn.Layer):
method __init__ (line 632) | def __init__(self,
method forward (line 697) | def forward(self, feats):
FILE: ppdet/modeling/heads/ppyoloe_ins_head.py
function custom_binary_cross_entropy_with_logits (line 33) | def custom_binary_cross_entropy_with_logits(x, y):
class MaskProto (line 40) | class MaskProto(nn.Layer):
method __init__ (line 42) | def __init__(self, ch_in, num_protos=256, num_masks=32, act='silu'):
method forward (line 54) | def forward(self, x):
function xyxy2xywh (line 58) | def xyxy2xywh(x):
function crop_mask (line 74) | def crop_mask(masks, boxes):
function process_mask_upsample (line 99) | def process_mask_upsample(protos, masks_in, bboxes, shape):
class PPYOLOEInsHead (line 124) | class PPYOLOEInsHead(nn.Layer):
method __init__ (line 131) | def __init__(self,
method from_config (line 232) | def from_config(cls, cfg, input_shape):
method _init_weights (line 237) | def _init_weights(self):
method forward_train (line 255) | def forward_train(self, feats, targets):
method _generate_anchors (line 293) | def _generate_anchors(self, feats=None, dtype='float32'):
method forward_eval (line 315) | def forward_eval(self, feats):
method forward (line 365) | def forward(self, feats, targets=None):
method _focal_loss (line 374) | def _focal_loss(score, label, alpha=0.25, gamma=2.0):
method _varifocal_loss (line 386) | def _varifocal_loss(pred_score, gt_score, label, alpha=0.75, gamma=2.0):
method _bbox_decode (line 394) | def _bbox_decode(self, anchor_points, pred_dist):
method _bbox_decode_fake (line 401) | def _bbox_decode_fake(self, pred_dist):
method _bbox2distance (line 409) | def _bbox2distance(self, points, bbox):
method _df_loss (line 428) | def _df_loss(self, pred_dist, target, lower_bound=0):
method get_loss (line 441) | def get_loss(self, head_outs, gt_meta):
method get_loss_from_assign (line 496) | def get_loss_from_assign(self, pred_scores, pred_distri, pred_bboxes,
method calculate_segmentation_loss (line 588) | def calculate_segmentation_loss(self,
method single_mask_loss (line 651) | def single_mask_loss(gt_mask, pred, proto, xyxy, area):
method post_process (line 683) | def post_process(self,
FILE: ppdet/modeling/heads/ppyoloe_r_head.py
class ESEAttn (line 29) | class ESEAttn(nn.Layer):
method __init__ (line 30) | def __init__(self, feat_channels, act='swish'):
method _init_weights (line 37) | def _init_weights(self):
method forward (line 40) | def forward(self, feat, avg_feat):
class PPYOLOERHead (line 46) | class PPYOLOERHead(nn.Layer):
method __init__ (line 50) | def __init__(self,
method from_config (line 115) | def from_config(cls, cfg, input_shape):
method _init_weights (line 118) | def _init_weights(self):
method _generate_anchors (line 136) | def _generate_anchors(self, feats):
method forward (line 175) | def forward(self, feats, targets=None):
method forward_train (line 184) | def forward_train(self, feats, targets):
method forward_eval (line 209) | def forward_eval(self, feats):
method _bbox_decode (line 239) | def _bbox_decode(self, points, pred_dist, pred_angle, stride_tensor):
method get_loss (line 249) | def get_loss(self, head_outs, gt_meta):
method _focal_loss (line 321) | def _focal_loss(score, label, alpha=0.25, gamma=2.0):
method _varifocal_loss (line 331) | def _varifocal_loss(pred_score, gt_score, label, alpha=0.75, gamma=2.0):
method _df_loss (line 338) | def _df_loss(pred_dist, target):
method _bbox_loss (line 349) | def _bbox_loss(self, pred_angle, pred_bboxes, anchor_points,
method _box2corners (line 385) | def _box2corners(self, pred_bboxes):
method post_process (line 408) | def post_process(self, head_outs, scale_factor):
FILE: ppdet/modeling/heads/retina_head.py
class RetinaFeat (line 34) | class RetinaFeat(FCOSFeat):
class RetinaHead (line 42) | class RetinaHead(nn.Layer):
method __init__ (line 51) | def __init__(self,
method forward (line 94) | def forward(self, neck_feats, targets=None):
method get_loss (line 109) | def get_loss(self, head_outputs, targets):
method get_bboxes_single (line 192) | def get_bboxes_single(self,
method decode (line 224) | def decode(self, anchors, cls_logits, bboxes_reg, im_shape, scale_fact...
method post_process (line 240) | def post_process(self, head_outputs, im_shape, scale_factor):
method get_scores_single (line 252) | def get_scores_single(self, cls_scores_list):
method decode_cls_logits (line 268) | def decode_cls_logits(self, cls_logits_list):
FILE: ppdet/modeling/heads/roi_extractor.py
function _to_list (line 21) | def _to_list(v):
class RoIAlign (line 28) | class RoIAlign(nn.Layer):
method __init__ (line 54) | def __init__(self,
method from_config (line 74) | def from_config(cls, cfg, input_shape):
method forward (line 77) | def forward(self, feats, roi, rois_num):
FILE: ppdet/modeling/heads/s2anet_head.py
class S2ANetHead (line 31) | class S2ANetHead(nn.Layer):
method __init__ (line 52) | def __init__(self,
method forward (line 245) | def forward(self, feats, targets=None):
method get_bboxes (line 325) | def get_bboxes(self, head_outs):
method get_pred (line 341) | def get_pred(self, bboxes, bbox_num, im_shape, scale_factor):
method get_bboxes_single (line 399) | def get_bboxes_single(self, cls_score_list, bbox_pred_list):
method smooth_l1_loss (line 436) | def smooth_l1_loss(self, pred, label, delta=1.0 / 9.0):
method get_fam_loss (line 451) | def get_fam_loss(self, fam_target, s2anet_head_out, reg_loss_type='l1'):
method get_odm_loss (line 532) | def get_odm_loss(self, odm_target, s2anet_head_out, reg_loss_type='l1'):
method get_loss (line 615) | def get_loss(self, head_outs, inputs):
method bbox_decode (line 680) | def bbox_decode(self, preds, anchors, wh_ratio_clip=1e-6):
method rbox2poly (line 709) | def rbox2poly(self, rboxes):
FILE: ppdet/modeling/heads/simota_head.py
class OTAHead (line 40) | class OTAHead(GFLHead):
method __init__ (line 61) | def __init__(self,
method _get_target_single (line 107) | def _get_target_single(self, flatten_cls_pred, flatten_center_and_stride,
method get_loss (line 117) | def get_loss(self, head_outs, gt_meta):
class OTAVFLHead (line 283) | class OTAVFLHead(OTAHead):
method __init__ (line 290) | def __init__(self,
method get_loss (line 336) | def get_loss(self, head_outs, gt_meta):
FILE: ppdet/modeling/heads/solov2_head.py
class SOLOv2MaskHead (line 35) | class SOLOv2MaskHead(nn.Layer):
method __init__ (line 50) | def __init__(self,
method forward (line 119) | def forward(self, inputs):
class SOLOv2Head (line 154) | class SOLOv2Head(nn.Layer):
method __init__ (line 174) | def __init__(self,
method _points_nms (line 261) | def _points_nms(self, heat, kernel_size=2):
method _split_feats (line 266) | def _split_feats(self, feats):
method forward (line 279) | def forward(self, input):
method _get_output_single (line 299) | def _get_output_single(self, input, idx):
method get_loss (line 344) | def get_loss(self, cate_preds, kernel_preds, ins_pred, ins_labels,
method get_prediction (line 409) | def get_prediction(self, cate_preds, kernel_preds, seg_pred, im_shape,
method get_seg_single (line 455) | def get_seg_single(self, cate_preds, seg_preds, kernel_preds, featmap_...
FILE: ppdet/modeling/heads/sparse_roi_head.py
class DynamicConv (line 36) | class DynamicConv(nn.Layer):
method __init__ (line 37) | def __init__(self,
method forward (line 65) | def forward(self, param_feature, input_feature):
class FFN (line 93) | class FFN(nn.Layer):
method __init__ (line 94) | def __init__(self,
method forward (line 116) | def forward(self, x):
class DynamicMaskHead (line 126) | class DynamicMaskHead(nn.Layer):
method __init__ (line 129) | def __init__(self,
method _init_weights (line 184) | def _init_weights(self):
method forward (line 191) | def forward(self, roi_features, attn_features):
class DIIHead (line 209) | class DIIHead(nn.Layer):
method __init__ (line 212) | def __init__(self,
method _init_weights (line 263) | def _init_weights(self):
method forward (line 271) | def forward(self, roi_features, proposal_features):
method refine_bboxes (line 306) | def refine_bboxes(proposal_bboxes, bbox_deltas):
class SparseRoIHead (line 317) | class SparseRoIHead(nn.Layer):
method __init__ (line 320) | def __init__(self,
method from_config (line 346) | def from_config(cls, cfg, input_shape):
method get_roi_features (line 362) | def get_roi_features(features, bboxes, roi_extractor):
method _forward_train (line 376) | def _forward_train(self, body_feats, pro_bboxes, pro_feats, targets):
method _forward_test (line 436) | def _forward_test(self, body_feats, pro_bboxes, pro_feats):
method forward (line 457) | def forward(self,
FILE: ppdet/modeling/heads/sparsercnn_head.py
class DynamicConv (line 37) | class DynamicConv(nn.Layer):
method __init__ (line 38) | def __init__(
method forward (line 62) | def forward(self, pro_features, roi_features):
class RCNNHead (line 91) | class RCNNHead(nn.Layer):
method __init__ (line 92) | def __init__(
method forward (line 151) | def forward(self, features, bboxes, pro_features, pooler):
class SparseRCNNHead (line 208) | class SparseRCNNHead(nn.Layer):
method __init__ (line 228) | def __init__(
method _reset_parameters (line 280) | def _reset_parameters(self):
method _init_box_pooler (line 302) | def _init_box_pooler(input_shape):
method forward (line 331) | def forward(self, features, input_whwh):
method get_loss (line 366) | def get_loss(self, outputs, targets):
function box_cxcywh_to_xyxy (line 377) | def box_cxcywh_to_xyxy(x):
FILE: ppdet/modeling/heads/ssd_head.py
class SepConvLayer (line 26) | class SepConvLayer(nn.Layer):
method __init__ (line 27) | def __init__(self,
method forward (line 58) | def forward(self, x):
class SSDExtraHead (line 65) | class SSDExtraHead(nn.Layer):
method __init__ (line 66) | def __init__(self,
method _make_layers (line 81) | def _make_layers(self, c_in, c_hidden, c_out, stride_3x3, padding_3x3):
method forward (line 87) | def forward(self, x):
class SSDHead (line 95) | class SSDHead(nn.Layer):
method __init__ (line 114) | def __init__(self,
method from_config (line 184) | def from_config(cls, cfg, input_shape):
method forward (line 187) | def forward(self, feats, image, gt_bbox=None, gt_class=None):
method get_loss (line 215) | def get_loss(self, boxes, scores, gt_bbox, gt_class, prior_boxes):
FILE: ppdet/modeling/heads/tood_head.py
class ScaleReg (line 34) | class ScaleReg(nn.Layer):
method __init__ (line 39) | def __init__(self, init_scale=1.):
method forward (line 46) | def forward(self, inputs):
class TaskDecomposition (line 51) | class TaskDecomposition(nn.Layer):
method __init__ (line 56) | def __init__(
method _init_weights (line 84) | def _init_weights(self):
method forward (line 88) | def forward(self, feat, avg_feat):
class TOODHead (line 103) | class TOODHead(nn.Layer):
method __init__ (line 110) | def __init__(self,
method from_config (line 189) | def from_config(cls, cfg, input_shape):
method _init_weights (line 195) | def _init_weights(self):
method _reg_grid_sample (line 209) | def _reg_grid_sample(self, feat, offset, anchor_points):
method forward (line 223) | def forward(self, feats):
method _focal_loss (line 285) | def _focal_loss(score, label, alpha=0.25, gamma=2.0):
method get_loss (line 294) | def get_loss(self, head_outs, gt_meta):
method post_process (line 359) | def post_process(self, head_outs, img_shape, scale_factor):
FILE: ppdet/modeling/heads/ttf_head.py
class HMHead (line 27) | class HMHead(nn.Layer):
method __init__ (line 44) | def __init__(
method forward (line 100) | def forward(self, feat):
class WHHead (line 107) | class WHHead(nn.Layer):
method __init__ (line 122) | def __init__(self,
method forward (line 174) | def forward(self, feat):
class TTFHead (line 182) | class TTFHead(nn.Layer):
method __init__ (line 213) | def __init__(self,
method from_config (line 242) | def from_config(cls, cfg, input_shape):
method forward (line 247) | def forward(self, feats):
method filter_box_by_weight (line 252) | def filter_box_by_weight(self, pred, target, weight):
method filter_loc_by_weight (line 263) | def filter_loc_by_weight(self, score, weight):
method get_loss (line 269) | def get_loss(self, pred_hm, pred_wh, target_hm, box_target, target_wei...
FILE: ppdet/modeling/heads/vitpose_head.py
class TopdownHeatmapSimpleHead (line 33) | class TopdownHeatmapSimpleHead(nn.Layer):
method __init__ (line 34) | def __init__(self,
method _get_deconv_cfg (line 128) | def _get_deconv_cfg(deconv_kernel):
method _init_inputs (line 144) | def _init_inputs(self, in_channels, in_index, input_transform):
method _transform_inputs (line 165) | def _tra
Condensed preview — 393 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,253K chars).
[
{
"path": ".gitignore",
"chars": 3139,
"preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packagi"
},
{
"path": "LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 5934,
"preview": "English | [简体中文](README_cn.md)\n\n## RT-DETRv3: Real-time End-to-End Object Detection with Hierarchical Dense Positive Sup"
},
{
"path": "configs/datasets/coco_detection.yml",
"chars": 661,
"preview": "metric: COCO\nnum_classes: 80\n\nTrainDataset:\n name: COCODataSet\n image_dir: train2017\n anno_path: annotations/instance"
},
{
"path": "configs/datasets/coco_instance.yml",
"chars": 576,
"preview": "metric: COCO\nnum_classes: 80\n\nTrainDataset:\n name: COCODataSet\n image_dir: train2017\n anno_path: annotations/instance"
},
{
"path": "configs/datasets/culane.yml",
"chars": 536,
"preview": "metric: CULaneMetric\nnum_classes: 5 # 4 lanes + background\n\ncut_height: &cut_height 270\ndataset_dir: &dataset_dir datase"
},
{
"path": "configs/datasets/dota.yml",
"chars": 571,
"preview": "metric: RBOX\nnum_classes: 15\n\nTrainDataset:\n !COCODataSet\n image_dir: trainval1024/images\n anno_path: trainval102"
},
{
"path": "configs/datasets/dota_ms.yml",
"chars": 580,
"preview": "metric: RBOX\nnum_classes: 15\n\nTrainDataset:\n !COCODataSet\n image_dir: trainval1024/images\n anno_path: trainval102"
},
{
"path": "configs/datasets/lvis_detection.yml",
"chars": 668,
"preview": "metric: LVIS\nnum_classes: 1203\n\nTrainDataset:\n name: LVISDataSet\n image_dir: .\n anno_path: annotations/lvis_v1_train."
},
{
"path": "configs/datasets/mcmot.yml",
"chars": 803,
"preview": "metric: MCMOT\nnum_classes: 10\n# using VisDrone2019 MOT dataset with 10 classes as default, you can modify it for your ne"
},
{
"path": "configs/datasets/mot.yml",
"chars": 728,
"preview": "metric: MOT\nnum_classes: 1\n\n# for MOT training\nTrainDataset:\n !MOTDataSet\n dataset_dir: dataset/mot\n image_lists:"
},
{
"path": "configs/datasets/objects365_detection.yml",
"chars": 503,
"preview": "metric: COCO\nnum_classes: 365\n\nTrainDataset:\n !COCODataSet\n image_dir: train\n anno_path: annotations/zhiyuan_objv"
},
{
"path": "configs/datasets/roadsign_voc.yml",
"chars": 494,
"preview": "metric: VOC\nmap_type: integral\nnum_classes: 4\n\nTrainDataset:\n name: VOCDataSet\n dataset_dir: dataset/roadsign_voc\n an"
},
{
"path": "configs/datasets/sniper_coco_detection.yml",
"chars": 1200,
"preview": "metric: SNIPERCOCO\nnum_classes: 80\n\nTrainDataset:\n !SniperCOCODataSet\n image_dir: train2017\n anno_path: annotatio"
},
{
"path": "configs/datasets/sniper_visdrone_detection.yml",
"chars": 1299,
"preview": "metric: SNIPERCOCO\nnum_classes: 9\n\nTrainDataset:\n !SniperCOCODataSet\n image_dir: train\n anno_path: annotations/tr"
},
{
"path": "configs/datasets/spine_coco.yml",
"chars": 528,
"preview": "metric: RBOX\nnum_classes: 9\n\nTrainDataset:\n !COCODataSet\n image_dir: images\n anno_path: annotations/train.json\n "
},
{
"path": "configs/datasets/visdrone_detection.yml",
"chars": 486,
"preview": "metric: COCO\nnum_classes: 10\n\nTrainDataset:\n !COCODataSet\n image_dir: VisDrone2019-DET-train\n anno_path: train.js"
},
{
"path": "configs/datasets/voc.yml",
"chars": 469,
"preview": "metric: VOC\nmap_type: 11point\nnum_classes: 20\n\nTrainDataset:\n name: VOCDataSet\n dataset_dir: dataset/voc\n anno_path: "
},
{
"path": "configs/datasets/wider_face.yml",
"chars": 573,
"preview": "metric: WiderFace\nnum_classes: 1\n\nTrainDataset:\n !WIDERFaceDataSet\n dataset_dir: dataset/wider_face\n anno_path: w"
},
{
"path": "configs/rtdetrv3/_base_/optimizer_6x.yml",
"chars": 312,
"preview": "epoch: 72\n\nLearningRate:\n base_lr: 0.0004\n schedulers:\n - !PiecewiseDecay\n gamma: 1.0\n milestones: [100]\n us"
},
{
"path": "configs/rtdetrv3/_base_/rtdetr_reader.yml",
"chars": 1286,
"preview": "worker_num: 4\nTrainReader:\n sample_transforms:\n - Decode: {}\n - RandomDistort: {prob: 0.8}\n - RandomExpand: {f"
},
{
"path": "configs/rtdetrv3/_base_/rtdetrv3_r50vd.yml",
"chars": 2013,
"preview": "architecture: RTDETRV3\npretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_vd_ssld_v2_pretraine"
},
{
"path": "configs/rtdetrv3/rtdetrv3_r18vd_6x_coco.yml",
"chars": 1101,
"preview": "_BASE_: [\n '../datasets/coco_detection.yml',\n '../runtime.yml',\n '_base_/optimizer_6x.yml',\n '_base_/rtdetrv3_r50vd."
},
{
"path": "configs/rtdetrv3/rtdetrv3_r18vd_6x_lvis.yml",
"chars": 1096,
"preview": "_BASE_: [\n '../datasets/lvis_detection.yml',\n '../runtime.yml',\n '_base_/optimizer_6x.yml',\n '_base_/rtdetrv3_r50vd."
},
{
"path": "configs/rtdetrv3/rtdetrv3_r34vd_6x_coco.yml",
"chars": 1104,
"preview": "_BASE_: [\n '../datasets/coco_detection.yml',\n '../runtime.yml',\n '_base_/optimizer_6x.yml',\n '_base_/rtdetrv3_r50vd."
},
{
"path": "configs/rtdetrv3/rtdetrv3_r50vd_6x_coco.yml",
"chars": 565,
"preview": "_BASE_: [\n '../datasets/coco_detection.yml',\n '../runtime.yml',\n '_base_/optimizer_6x.yml',\n '_base_/rtdetrv3_r50vd."
},
{
"path": "configs/rtdetrv3/rtdetrv3_r50vd_6x_lvis.yml",
"chars": 578,
"preview": "_BASE_: [\n '../datasets/lvis_detection.yml',\n '../runtime.yml',\n '_base_/optimizer_6x.yml',\n '_base_/rtdetrv3_r50vd."
},
{
"path": "configs/runtime.yml",
"chars": 498,
"preview": "use_gpu: true\nuse_xpu: false\nuse_mlu: false\nuse_npu: false\nlog_iter: 20\nsave_dir: output\nsnapshot_epoch: 1\nprint_flops: "
},
{
"path": "dataset/coco/download_coco.py",
"chars": 1023,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "dataset/dota/.gitignore",
"chars": 0,
"preview": ""
},
{
"path": "dataset/mot/gen_labels_MOT.py",
"chars": 2158,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "dataset/roadsign_voc/download_roadsign_voc.py",
"chars": 1031,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "dataset/roadsign_voc/label_list.txt",
"chars": 38,
"preview": "speedlimit\ncrosswalk\ntrafficlight\nstop"
},
{
"path": "dataset/spine_coco/download_spine_coco.py",
"chars": 1029,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "dataset/voc/create_list.py",
"chars": 1003,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "dataset/voc/download_voc.py",
"chars": 1022,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "dataset/voc/label_list.txt",
"chars": 135,
"preview": "aeroplane\nbicycle\nbird\nboat\nbottle\nbus\ncar\ncat\nchair\ncow\ndiningtable\ndog\nhorse\nmotorbike\nperson\npottedplant\nsheep\nsofa\nt"
},
{
"path": "dataset/wider_face/download_wider_face.sh",
"chars": 729,
"preview": "# All rights `PaddleDetection` reserved\n# References:\n# @inproceedings{yang2016wider,\n# Author = {Yang, Shuo and Luo"
},
{
"path": "ppdet/__init__.py",
"chars": 1039,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/core/__init__.py",
"chars": 634,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (th"
},
{
"path": "ppdet/core/config/__init__.py",
"chars": 610,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/core/config/schema.py",
"chars": 8066,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/core/config/yaml_helpers.py",
"chars": 3571,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/core/workspace.py",
"chars": 9425,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/__init__.py",
"chars": 778,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/data/crop_utils/__init__.py",
"chars": 609,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/crop_utils/annotation_cropper.py",
"chars": 23552,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/crop_utils/chip_box_utils.py",
"chars": 5376,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/culane_utils.py",
"chars": 4408,
"preview": "import math\nimport numpy as np\nfrom imgaug.augmentables.lines import LineString\nfrom scipy.interpolate import Interpolat"
},
{
"path": "ppdet/data/reader.py",
"chars": 23332,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/shm_utils.py",
"chars": 2510,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/source/__init__.py",
"chars": 1087,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/source/category.py",
"chars": 24501,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/data/source/coco.py",
"chars": 23589,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/data/source/culane.py",
"chars": 7509,
"preview": "from ppdet.core.workspace import register, serializable\nimport cv2\nimport os\nimport tarfile\nimport numpy as np\nimport os"
},
{
"path": "ppdet/data/source/dataset.py",
"chars": 11407,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/data/source/keypoint_coco.py",
"chars": 28350,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/data/source/lvis.py",
"chars": 9932,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/data/source/mot.py",
"chars": 24020,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/source/pose3d_cmb.py",
"chars": 13907,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/data/source/sniper_coco.py",
"chars": 6837,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/source/voc.py",
"chars": 8789,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/source/widerface.py",
"chars": 10453,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/__init__.py",
"chars": 1196,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/atss_assigner.py",
"chars": 18314,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/autoaugment_utils.py",
"chars": 65622,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/batch_operators.py",
"chars": 66120,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/culane_operators.py",
"chars": 12169,
"preview": "import numpy as np\nimport imgaug.augmenters as iaa\nfrom .operators import BaseOperator, register_op\nfrom ppdet.utils.log"
},
{
"path": "ppdet/data/transform/gridmask_utils.py",
"chars": 2903,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/keypoint_operators.py",
"chars": 66140,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/keypoints_3d_operators.py",
"chars": 10343,
"preview": "# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/mot_operators.py",
"chars": 25831,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/op_helper.py",
"chars": 17228,
"preview": "# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/operators.py",
"chars": 160450,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/transform/rotated_operators.py",
"chars": 17452,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/data/utils.py",
"chars": 2835,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/engine/__init__.py",
"chars": 1089,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/engine/callbacks.py",
"chars": 31225,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/engine/env.py",
"chars": 1558,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/engine/export_utils.py",
"chars": 17870,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/engine/naive_sync_bn.py",
"chars": 3516,
"preview": "import paddle.distributed as dist\nimport math\nimport paddle\nimport paddle.nn as nn\n\n\nclass _AllReduce(paddle.autograd.Py"
},
{
"path": "ppdet/engine/tracker.py",
"chars": 30544,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/engine/trainer.py",
"chars": 64612,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/engine/trainer_cot.py",
"chars": 1432,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/engine/trainer_ssod.py",
"chars": 51626,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/ext_op/README.md",
"chars": 625,
"preview": "# 自定义OP编译\n旋转框IOU计算OP是参考[自定义外部算子](https://www.paddlepaddle.org.cn/documentation/docs/zh/guides/custom_op/new_cpp_op_cn.ht"
},
{
"path": "ppdet/ext_op/csrc/matched_rbox_iou/matched_rbox_iou.cc",
"chars": 3360,
"preview": "// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 "
},
{
"path": "ppdet/ext_op/csrc/matched_rbox_iou/matched_rbox_iou.cu",
"chars": 2201,
"preview": "// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 "
},
{
"path": "ppdet/ext_op/csrc/nms_rotated/nms_rotated.cc",
"chars": 4386,
"preview": "// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 "
},
{
"path": "ppdet/ext_op/csrc/nms_rotated/nms_rotated.cu",
"chars": 3923,
"preview": "// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 "
},
{
"path": "ppdet/ext_op/csrc/rbox_iou/rbox_iou.cc",
"chars": 3409,
"preview": "// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 "
},
{
"path": "ppdet/ext_op/csrc/rbox_iou/rbox_iou.cu",
"chars": 4309,
"preview": "// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 "
},
{
"path": "ppdet/ext_op/csrc/rbox_iou/rbox_iou_utils.h",
"chars": 10605,
"preview": "// Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 "
},
{
"path": "ppdet/ext_op/setup.py",
"chars": 940,
"preview": "import os\nimport glob\nimport paddle\nfrom paddle.utils.cpp_extension import CppExtension, CUDAExtension, setup\n\n\ndef get_"
},
{
"path": "ppdet/ext_op/unittest/test_matched_rbox_iou.py",
"chars": 4314,
"preview": "import numpy as np\nimport sys\nimport time\nfrom shapely.geometry import Polygon\nimport paddle\nimport unittest\n\nfrom ext_o"
},
{
"path": "ppdet/ext_op/unittest/test_rbox_iou.py",
"chars": 4406,
"preview": "import numpy as np\nimport sys\nimport time\nfrom shapely.geometry import Polygon\nimport paddle\nimport unittest\n\nfrom ext_o"
},
{
"path": "ppdet/metrics/__init__.py",
"chars": 1124,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/metrics/coco_utils.py",
"chars": 7586,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/metrics/culane_metrics.py",
"chars": 10973,
"preview": "import os\nimport cv2\nimport numpy as np\nimport os.path as osp\nfrom functools import partial\nfrom .metrics import Metric\n"
},
{
"path": "ppdet/metrics/fast_cocoeval/README.md",
"chars": 67,
"preview": "# COCOeval C++ 扩展编译\n\n## 安装\n```\ncd ext\npython setup.py install\n```\n\n"
},
{
"path": "ppdet/metrics/fast_cocoeval/__init__.py",
"chars": 668,
"preview": "# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/metrics/fast_cocoeval/ext/cocoeval.cc",
"chars": 21703,
"preview": "// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (t"
},
{
"path": "ppdet/metrics/fast_cocoeval/ext/cocoeval.h",
"chars": 4110,
"preview": "// Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (t"
},
{
"path": "ppdet/metrics/fast_cocoeval/ext/setup.py",
"chars": 285,
"preview": "from pybind11.setup_helpers import Pybind11Extension, build_ext\nfrom setuptools import setup\n\next_modules = [Pybind11Ext"
},
{
"path": "ppdet/metrics/fast_cocoeval/fast_cocoeval.py",
"chars": 5856,
"preview": "# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/metrics/json_results.py",
"chars": 5909,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (th"
},
{
"path": "ppdet/metrics/keypoint_metrics.py",
"chars": 21141,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/metrics/lvis_utils.py",
"chars": 4252,
"preview": "# \n# Unless required by applicable law or agreed to in writing, software \n# distributed under the License is distrib"
},
{
"path": "ppdet/metrics/map_utils.py",
"chars": 15486,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/metrics/mcmot_metrics.py",
"chars": 16391,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/metrics/metrics.py",
"chars": 28474,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/metrics/mot_metrics.py",
"chars": 52006,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/metrics/munkres.py",
"chars": 13416,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/metrics/pose3d_metrics.py",
"chars": 6508,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/metrics/widerface_utils.py",
"chars": 17667,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/model_zoo/.gitignore",
"chars": 10,
"preview": "MODEL_ZOO\n"
},
{
"path": "ppdet/model_zoo/__init__.py",
"chars": 720,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/model_zoo/model_zoo.py",
"chars": 2774,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/model_zoo/tests/__init__.py",
"chars": 612,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (th"
},
{
"path": "ppdet/model_zoo/tests/test_get_model.py",
"chars": 1446,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (th"
},
{
"path": "ppdet/model_zoo/tests/test_list_model.py",
"chars": 1750,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (th"
},
{
"path": "ppdet/modeling/__init__.py",
"chars": 1452,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/__init__.py",
"chars": 2317,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/blazeface.py",
"chars": 4088,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/architectures/bytetrack.py",
"chars": 2362,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/cascade_rcnn.py",
"chars": 5425,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/centernet.py",
"chars": 3461,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/centertrack.py",
"chars": 6530,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/clrnet.py",
"chars": 1928,
"preview": "from .meta_arch import BaseArch\nfrom ppdet.core.workspace import register, create\nfrom paddle import in_dynamic_mode\n\n__"
},
{
"path": "ppdet/modeling/architectures/deepsort.py",
"chars": 2109,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/detr.py",
"chars": 3936,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/architectures/detr_ssod.py",
"chars": 13876,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/fairmot.py",
"chars": 3200,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/faster_rcnn.py",
"chars": 6237,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/fcos.py",
"chars": 7531,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/gfl.py",
"chars": 2706,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/jde.py",
"chars": 3540,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/keypoint_hrhrnet.py",
"chars": 11569,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/keypoint_hrnet.py",
"chars": 16377,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n#\n# Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "ppdet/modeling/architectures/keypoint_petr.py",
"chars": 8677,
"preview": "# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. \n#\n# Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "ppdet/modeling/architectures/keypoint_vitpose.py",
"chars": 11688,
"preview": "# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. \n#\n# Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "ppdet/modeling/architectures/mask_rcnn.py",
"chars": 5919,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/meta_arch.py",
"chars": 4652,
"preview": "from __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\n\nimport num"
},
{
"path": "ppdet/modeling/architectures/multi_stream_detector.py",
"chars": 2661,
"preview": "from typing import Dict\nfrom collections import OrderedDict\nfrom ppdet.modeling.architectures.meta_arch import BaseArch\n"
},
{
"path": "ppdet/modeling/architectures/picodet.py",
"chars": 3189,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/pose3d_metro.py",
"chars": 4006,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. \n#\n# Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "ppdet/modeling/architectures/ppyoloe.py",
"chars": 9094,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/queryinst.py",
"chars": 3571,
"preview": "# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/architectures/retinanet.py",
"chars": 2887,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/architectures/rtdetrv3.py",
"chars": 4724,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/architectures/s2anet.py",
"chars": 2807,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n# \n# Licensed under the Apache License, Version 2.0 (t"
},
{
"path": "ppdet/modeling/architectures/solov2.py",
"chars": 3780,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/architectures/sparse_rcnn.py",
"chars": 3238,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/architectures/ssd.py",
"chars": 4235,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/architectures/tood.py",
"chars": 2388,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/architectures/ttfnet.py",
"chars": 3135,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/yolo.py",
"chars": 5811,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/yolof.py",
"chars": 2851,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/architectures/yolox.py",
"chars": 4772,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/__init__.py",
"chars": 1257,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/atss_assigner.py",
"chars": 10449,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/clrnet_assigner.py",
"chars": 5474,
"preview": "import paddle\nimport paddle.nn.functional as F\nfrom ppdet.modeling.losses.clrnet_line_iou_loss import line_iou\n\n\ndef dis"
},
{
"path": "ppdet/modeling/assigners/fcosr_assigner.py",
"chars": 10157,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/hungarian_assigner.py",
"chars": 12399,
"preview": "# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/max_iou_assigner.py",
"chars": 1969,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/pose_utils.py",
"chars": 9965,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/rotated_task_aligned_assigner.py",
"chars": 7432,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/simota_assigner.py",
"chars": 11428,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/task_aligned_assigner.py",
"chars": 8526,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/task_aligned_assigner_cr.py",
"chars": 8072,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/uniform_assigner.py",
"chars": 3740,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/assigners/utils.py",
"chars": 9683,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/__init__.py",
"chars": 1973,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/backbones/blazenet.py",
"chars": 11449,
"preview": "# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.\n#\n# Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "ppdet/modeling/backbones/clrnet_resnet.py",
"chars": 25726,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/convnext.py",
"chars": 8621,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/backbones/csp_darknet.py",
"chars": 13841,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/backbones/cspresnet.py",
"chars": 10417,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/darknet.py",
"chars": 11373,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/dla.py",
"chars": 8562,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/backbones/esnet.py",
"chars": 9503,
"preview": "# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.\n#\n# Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "ppdet/modeling/backbones/focalnet.py",
"chars": 26923,
"preview": "# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/ghostnet.py",
"chars": 16441,
"preview": "# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.\n#\n# Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "ppdet/modeling/backbones/hardnet.py",
"chars": 6960,
"preview": "# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.\n#\n# Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "ppdet/modeling/backbones/hgnet_v2.py",
"chars": 15805,
"preview": "# copyright (c) 2023 PaddlePaddle Authors. All Rights Reserve.\n#\n# Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "ppdet/modeling/backbones/hrnet.py",
"chars": 29732,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/lcnet.py",
"chars": 8964,
"preview": "# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.\n#\n# Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "ppdet/modeling/backbones/lite_hrnet.py",
"chars": 33756,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/mobilenet_v1.py",
"chars": 13591,
"preview": "# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.\n#\n# Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "ppdet/modeling/backbones/mobilenet_v3.py",
"chars": 16761,
"preview": "# copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.\n#\n# Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "ppdet/modeling/backbones/mobileone.py",
"chars": 9748,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/name_adapter.py",
"chars": 2328,
"preview": "class NameAdapter(object):\n \"\"\"Fix the backbones variable names for pretrained weight\"\"\"\n\n def __init__(self, mode"
},
{
"path": "ppdet/modeling/backbones/res2net.py",
"chars": 11904,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/resnet.py",
"chars": 19958,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/backbones/senet.py",
"chars": 5144,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. \n# \n# Licensed under the Apache License, Version 2.0 ("
},
{
"path": "ppdet/modeling/backbones/shufflenet_v2.py",
"chars": 8441,
"preview": "# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.\n#\n# Licensed under the Apache License, Version 2.0 (the \""
},
{
"path": "ppdet/modeling/backbones/swin_transformer.py",
"chars": 28056,
"preview": "# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/trans_encoder.py",
"chars": 14947,
"preview": "# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/transformer_utils.py",
"chars": 4064,
"preview": "# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the "
},
{
"path": "ppdet/modeling/backbones/vgg.py",
"chars": 6560,
"preview": "from __future__ import division\n\nimport paddle\nimport paddle.nn as nn\nimport paddle.nn.functional as F\nfrom paddle impor"
}
]
// ... and 193 more files (download for full content)
About this extraction
This page contains the full source code of the clxia12/RT-DETRv3 GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 393 files (3.9 MB), approximately 1.0M tokens, and a symbol index with 4298 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.