master 3e63c1869dd6 cached
358 files
4.4 MB
1.2M tokens
1896 symbols
1 requests
Download .txt
Showing preview only (4,656K chars total). Download the full file or copy to clipboard to get everything.
Repository: stevewongv/InstanceShadowDetection
Branch: master
Commit: 3e63c1869dd6
Files: 358
Total size: 4.4 MB

Directory structure:
gitextract_46mmgy8a/

├── .gitignore
├── LICENSE
├── PythonAPI/
│   ├── Makefile
│   ├── common/
│   │   ├── gason.cpp
│   │   ├── gason.h
│   │   ├── maskApi.c
│   │   └── maskApi.h
│   ├── pysobatools/
│   │   ├── __init__.py
│   │   ├── _mask.c
│   │   ├── _mask.pyx
│   │   ├── cocoeval.py
│   │   ├── mask.py
│   │   ├── soba.py
│   │   └── sobaeval.py
│   └── setup.py
├── README.md
├── configs/
│   ├── Base-RCNN-C4.yaml
│   ├── Base-RCNN-DilatedC5.yaml
│   ├── Base-RCNN-FPN.yaml
│   ├── Base-RetinaNet.yaml
│   ├── COCO-Detection/
│   │   ├── fast_rcnn_R_50_FPN_1x.yaml
│   │   ├── faster_rcnn_R_101_C4_3x.yaml
│   │   ├── faster_rcnn_R_101_DC5_3x.yaml
│   │   ├── faster_rcnn_R_101_FPN_3x.yaml
│   │   ├── faster_rcnn_R_50_C4_1x.yaml
│   │   ├── faster_rcnn_R_50_C4_3x.yaml
│   │   ├── faster_rcnn_R_50_DC5_1x.yaml
│   │   ├── faster_rcnn_R_50_DC5_3x.yaml
│   │   ├── faster_rcnn_R_50_FPN_1x.yaml
│   │   ├── faster_rcnn_R_50_FPN_3x.yaml
│   │   ├── faster_rcnn_X_101_32x8d_FPN_3x.yaml
│   │   ├── retinanet_R_101_FPN_3x.yaml
│   │   ├── retinanet_R_50_FPN_1x.yaml
│   │   ├── retinanet_R_50_FPN_3x.yaml
│   │   ├── rpn_R_50_C4_1x.yaml
│   │   └── rpn_R_50_FPN_1x.yaml
│   ├── COCO-InstanceSegmentation/
│   │   ├── mask_rcnn_R_101_C4_3x.yaml
│   │   ├── mask_rcnn_R_101_DC5_3x.yaml
│   │   ├── mask_rcnn_R_101_FPN_3x.yaml
│   │   ├── mask_rcnn_R_50_C4_1x.yaml
│   │   ├── mask_rcnn_R_50_C4_3x.yaml
│   │   ├── mask_rcnn_R_50_DC5_1x.yaml
│   │   ├── mask_rcnn_R_50_DC5_3x.yaml
│   │   ├── mask_rcnn_R_50_FPN_1x.yaml
│   │   ├── mask_rcnn_R_50_FPN_3x.yaml
│   │   └── mask_rcnn_X_101_32x8d_FPN_3x.yaml
│   ├── COCO-Keypoints/
│   │   ├── Base-Keypoint-RCNN-FPN.yaml
│   │   ├── keypoint_rcnn_R_101_FPN_3x.yaml
│   │   ├── keypoint_rcnn_R_50_FPN_1x.yaml
│   │   ├── keypoint_rcnn_R_50_FPN_3x.yaml
│   │   └── keypoint_rcnn_X_101_32x8d_FPN_3x.yaml
│   ├── COCO-PanopticSegmentation/
│   │   ├── Base-Panoptic-FPN.yaml
│   │   ├── panoptic_fpn_R_101_3x.yaml
│   │   ├── panoptic_fpn_R_50_1x.yaml
│   │   └── panoptic_fpn_R_50_3x.yaml
│   ├── Cityscapes/
│   │   └── mask_rcnn_R_50_FPN.yaml
│   ├── Detectron1-Comparisons/
│   │   ├── README.md
│   │   ├── faster_rcnn_R_50_FPN_noaug_1x.yaml
│   │   ├── keypoint_rcnn_R_50_FPN_1x.yaml
│   │   └── mask_rcnn_R_50_FPN_noaug_1x.yaml
│   ├── LVIS-InstanceSegmentation/
│   │   ├── mask_rcnn_R_101_FPN_1x.yaml
│   │   ├── mask_rcnn_R_50_FPN_1x.yaml
│   │   └── mask_rcnn_X_101_32x8d_FPN_1x.yaml
│   ├── Misc/
│   │   ├── cascade_mask_rcnn_R_50_FPN_1x.yaml
│   │   ├── cascade_mask_rcnn_R_50_FPN_3x.yaml
│   │   ├── cascade_mask_rcnn_X_152_32x8d_FPN_IN5k_gn_dconv.yaml
│   │   ├── mask_rcnn_R_50_FPN_1x_cls_agnostic.yaml
│   │   ├── mask_rcnn_R_50_FPN_1x_dconv_c3-c5.yaml
│   │   ├── mask_rcnn_R_50_FPN_3x_dconv_c3-c5.yaml
│   │   ├── mask_rcnn_R_50_FPN_3x_gn.yaml
│   │   ├── mask_rcnn_R_50_FPN_3x_syncbn.yaml
│   │   ├── panoptic_fpn_R_101_dconv_cascade_gn_3x.yaml
│   │   ├── scratch_mask_rcnn_R_50_FPN_3x_gn.yaml
│   │   └── semantic_R_50_FPN_1x.yaml
│   ├── PascalVOC-Detection/
│   │   ├── faster_rcnn_R_50_C4.yaml
│   │   └── faster_rcnn_R_50_FPN.yaml
│   └── quick_schedules/
│       ├── README.md
│       ├── fast_rcnn_R_50_FPN_inference_acc_test.yaml
│       ├── fast_rcnn_R_50_FPN_instant_test.yaml
│       ├── keypoint_rcnn_R_50_FPN_inference_acc_test.yaml
│       ├── keypoint_rcnn_R_50_FPN_instant_test.yaml
│       ├── keypoint_rcnn_R_50_FPN_normalized_training_acc_test.yaml
│       ├── keypoint_rcnn_R_50_FPN_training_acc_test.yaml
│       ├── mask_rcnn_R_50_C4_inference_acc_test.yaml
│       ├── mask_rcnn_R_50_C4_instant_test.yaml
│       ├── mask_rcnn_R_50_C4_training_acc_test.yaml
│       ├── mask_rcnn_R_50_DC5_inference_acc_test.yaml
│       ├── mask_rcnn_R_50_FPN_inference_acc_test.yaml
│       ├── mask_rcnn_R_50_FPN_instant_test.yaml
│       ├── mask_rcnn_R_50_FPN_training_acc_test.yaml
│       ├── panoptic_fpn_R_50_inference_acc_test.yaml
│       ├── panoptic_fpn_R_50_instant_test.yaml
│       ├── panoptic_fpn_R_50_training_acc_test.yaml
│       ├── retinanet_R_50_FPN_inference_acc_test.yaml
│       ├── retinanet_R_50_FPN_instant_test.yaml
│       ├── rpn_R_50_FPN_inference_acc_test.yaml
│       ├── rpn_R_50_FPN_instant_test.yaml
│       ├── semantic_R_50_FPN_inference_acc_test.yaml
│       ├── semantic_R_50_FPN_instant_test.yaml
│       └── semantic_R_50_FPN_training_acc_test.yaml
├── datasets/
│   ├── README.md
│   ├── prepare_for_tests.sh
│   └── prepare_panoptic_fpn.py
├── demo/
│   ├── README.md
│   ├── demo.py
│   └── predictor.py
├── detectron2/
│   ├── __init__.py
│   ├── checkpoint/
│   │   ├── __init__.py
│   │   ├── c2_model_loading.py
│   │   ├── catalog.py
│   │   ├── detection_checkpoint.py
│   │   └── model_zoo.py
│   ├── config/
│   │   ├── __init__.py
│   │   ├── compat.py
│   │   ├── config.py
│   │   └── defaults.py
│   ├── data/
│   │   ├── __init__.py
│   │   ├── build.py
│   │   ├── catalog.py
│   │   ├── common.py
│   │   ├── dataset_mapper.py
│   │   ├── dataset_mapper.py.bak
│   │   ├── datasets/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── builtin.py
│   │   │   ├── builtin_meta.py
│   │   │   ├── cityscapes.py
│   │   │   ├── coco.py
│   │   │   ├── lvis.py
│   │   │   ├── lvis_v0_5_categories.py
│   │   │   ├── pascal_voc.py
│   │   │   ├── register_coco.py
│   │   │   ├── register_soba.py
│   │   │   └── soba.py
│   │   ├── detection_utils.py
│   │   ├── samplers/
│   │   │   ├── __init__.py
│   │   │   ├── distributed_sampler.py
│   │   │   └── grouped_batch_sampler.py
│   │   └── transforms/
│   │       ├── __init__.py
│   │       ├── transform.py
│   │       └── transform_gen.py
│   ├── engine/
│   │   ├── __init__.py
│   │   ├── defaults.py
│   │   ├── hooks.py
│   │   ├── launch.py
│   │   └── train_loop.py
│   ├── evaluation/
│   │   ├── __init__.py
│   │   ├── cityscapes_evaluation.py
│   │   ├── coco_evaluation.py
│   │   ├── evaluation/
│   │   │   ├── __init__.py
│   │   │   ├── cityscapes_evaluation.py
│   │   │   ├── coco_evaluation.py
│   │   │   ├── evaluator.py
│   │   │   ├── lvis_evaluation.py
│   │   │   ├── panoptic_evaluation.py
│   │   │   ├── pascal_voc_evaluation.py
│   │   │   ├── sem_seg_evaluation.py
│   │   │   └── testing.py
│   │   ├── evaluator.py
│   │   ├── lvis_evaluation.py
│   │   ├── panoptic_evaluation.py
│   │   ├── pascal_voc_evaluation.py
│   │   ├── rotated_coco_evaluation.py
│   │   ├── sem_seg_evaluation.py
│   │   ├── soba_evaluation.py
│   │   └── testing.py
│   ├── export/
│   │   ├── README.md
│   │   ├── __init__.py
│   │   ├── api.py
│   │   ├── c10.py
│   │   ├── caffe2_export.py
│   │   ├── caffe2_inference.py
│   │   ├── caffe2_modeling.py
│   │   ├── patcher.py
│   │   └── shared.py
│   ├── layers/
│   │   ├── __init__.py
│   │   ├── aspp.py
│   │   ├── batch_norm.py
│   │   ├── blocks.py
│   │   ├── csrc/
│   │   │   ├── README.md
│   │   │   ├── ROIAlignRotated/
│   │   │   │   ├── ROIAlignRotated.h
│   │   │   │   ├── ROIAlignRotated_cpu.cpp
│   │   │   │   └── ROIAlignRotated_cuda.cu
│   │   │   ├── box_iou_rotated/
│   │   │   │   ├── box_iou_rotated.h
│   │   │   │   ├── box_iou_rotated_cpu.cpp
│   │   │   │   ├── box_iou_rotated_cuda.cu
│   │   │   │   └── box_iou_rotated_utils.h
│   │   │   ├── cocoeval/
│   │   │   │   ├── cocoeval.cpp
│   │   │   │   └── cocoeval.h
│   │   │   ├── cuda_version.cu
│   │   │   ├── deformable/
│   │   │   │   ├── deform_conv.h
│   │   │   │   ├── deform_conv_cuda.cu
│   │   │   │   └── deform_conv_cuda_kernel.cu
│   │   │   ├── nms_rotated/
│   │   │   │   ├── nms_rotated.h
│   │   │   │   ├── nms_rotated_cpu.cpp
│   │   │   │   └── nms_rotated_cuda.cu
│   │   │   └── vision.cpp
│   │   ├── deform_conv.py
│   │   ├── losses.py
│   │   ├── mask_ops.py
│   │   ├── nms.py
│   │   ├── roi_align.py
│   │   ├── roi_align_rotated.py
│   │   ├── rotated_boxes.py
│   │   ├── shape_spec.py
│   │   └── wrappers.py
│   ├── modeling/
│   │   ├── __init__.py
│   │   ├── anchor_generator.py
│   │   ├── backbone/
│   │   │   ├── __init__.py
│   │   │   ├── backbone.py
│   │   │   ├── build.py
│   │   │   ├── fpn.py
│   │   │   └── resnet.py
│   │   ├── box_regression.py
│   │   ├── matcher.py
│   │   ├── meta_arch/
│   │   │   ├── LISA_meta_arch.py
│   │   │   ├── __init__.py
│   │   │   ├── build.py
│   │   │   ├── panoptic_fpn.py
│   │   │   ├── rcnn.py
│   │   │   ├── retinanet.py
│   │   │   └── semantic_seg.py
│   │   ├── poolers.py
│   │   ├── postprocessing.py
│   │   ├── proposal_generator/
│   │   │   ├── LISA_rpn.py
│   │   │   ├── __init__.py
│   │   │   ├── build.py
│   │   │   ├── proposal_utils.py
│   │   │   ├── rpn.py
│   │   │   ├── rpn_outputs.py
│   │   │   ├── rrpn.py
│   │   │   └── rrpn_outputs.py
│   │   ├── roi_heads/
│   │   │   ├── LISA_rcnn.py
│   │   │   ├── __init__.py
│   │   │   ├── box_head.py
│   │   │   ├── cascade_rcnn.py
│   │   │   ├── fast_rcnn.py
│   │   │   ├── keypoint_head.py
│   │   │   ├── mask_head.py
│   │   │   ├── roi_heads.py
│   │   │   └── rotated_fast_rcnn.py
│   │   ├── sampling.py
│   │   └── test_time_augmentation.py
│   ├── solver/
│   │   ├── __init__.py
│   │   ├── build.py
│   │   └── lr_scheduler.py
│   ├── structures/
│   │   ├── __init__.py
│   │   ├── boxes.py
│   │   ├── image_list.py
│   │   ├── instances.py
│   │   ├── keypoints.py
│   │   ├── masks.py
│   │   └── rotated_boxes.py
│   └── utils/
│       ├── README.md
│       ├── __init__.py
│       ├── collect_env.py
│       ├── colormap.py
│       ├── comm.py
│       ├── develop.py
│       ├── env.py
│       ├── events.py
│       ├── logger.py
│       ├── memory.py
│       ├── registry.py
│       ├── serialize.py
│       ├── video_visualizer.py
│       ├── visualizer.py
│       └── visualizer.py.back
├── dev/
│   ├── README.md
│   ├── linter.sh
│   ├── packaging/
│   │   ├── README.md
│   │   ├── build_all_wheels.sh
│   │   ├── build_wheel.sh
│   │   ├── gen_wheel_index.sh
│   │   └── pkg_helpers.bash
│   ├── parse_results.sh
│   ├── run_inference_tests.sh
│   └── run_instant_tests.sh
├── docker/
│   ├── Dockerfile
│   ├── Dockerfile-circleci
│   └── docker-compose.yml
├── docs/
│   ├── .gitignore
│   ├── Makefile
│   ├── README.md
│   ├── conf.py
│   ├── index.rst
│   ├── modules/
│   │   ├── checkpoint.rst
│   │   ├── config.rst
│   │   ├── data.rst
│   │   ├── engine.rst
│   │   ├── evaluation.rst
│   │   ├── export.rst
│   │   ├── index.rst
│   │   ├── layers.rst
│   │   ├── model_zoo.rst
│   │   ├── modeling.rst
│   │   ├── solver.rst
│   │   ├── structures.rst
│   │   └── utils.rst
│   ├── notes/
│   │   ├── benchmarks.md
│   │   ├── changelog.md
│   │   ├── compatibility.md
│   │   └── index.rst
│   └── tutorials/
│       ├── README.md
│       ├── configs.md
│       ├── data_loading.md
│       ├── datasets.md
│       ├── deployment.md
│       ├── evaluation.md
│       ├── extend.md
│       ├── index.rst
│       ├── models.md
│       ├── training.md
│       └── write-models.md
├── projects/
│   └── LISA/
│       ├── LISA/
│       │   ├── LISA_meta_arch.py
│       │   ├── LISA_rcnn.py
│       │   ├── LISA_rpn.py
│       │   ├── __init__.py
│       │   └── config.py
│       ├── SOAP.py
│       ├── __init__.py
│       ├── config/
│       │   ├── Base-RCNN-FPN.yaml
│       │   ├── LISA_101_FPN_3x.yaml
│       │   └── LISA_101_FPN_3x_demo.yaml
│       ├── defaults.py
│       ├── demo.py
│       ├── output_light/
│       │   ├── inference/
│       │   │   ├── soba_association_results.json
│       │   │   └── soba_instances_results.json
│       │   └── last_checkpoint
│       ├── predictor.py
│       ├── train_net.py
│       ├── utils.py
│       ├── visualize_data.py
│       └── visualize_json_results.py
├── setup.cfg
├── setup.py
└── tests/
    ├── README.md
    ├── __init__.py
    ├── test_anchor_generator.py
    ├── test_box2box_transform.py
    ├── test_boxes.py
    ├── test_checkpoint.py
    ├── test_config.py
    ├── test_data_loader.py
    ├── test_data_transform.py
    ├── test_fast_rcnn.py
    ├── test_mask_ops.py
    ├── test_model_e2e.py
    ├── test_model_zoo.py
    ├── test_nms_rotated.py
    ├── test_roi_align.py
    ├── test_roi_align_rotated.py
    ├── test_roi_heads.py
    ├── test_roi_pooler.py
    ├── test_rotated_boxes.py
    ├── test_rpn.py
    ├── test_sampler.py
    └── test_visualizer.py

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
/docker/clipboard.txt
/projects/LISA/.ipynb_checkpoints/*
!/projects/LISA/.SOAP.ipynb.icloud
*/.DS_Store 
.DS_Store
# output dir
output
instant_test_output
inference_test_output



*.txt

# compilation and distribution
__pycache__
_ext
*.pyc
*.so
*egg-info/
build/
dist/

# pytorch/python/numpy formats
*.pth
*.pkl
*.npy

# ipython/jupyter notebooks
*.ipynb
**/.ipynb_checkpoints/

# Editor temporaries
*.swn
*.swo
*.swp
*~

# Pycharm editor settings
.idea
.vscode
.python-version

# project dirs
/datasets/coco
/datasets/lvis
/datasets/cityscapes
/models
/debug
/weights
eval.sh

*.DS_Store


================================================
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 2019, Facebook, Inc

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: PythonAPI/Makefile
================================================
all:
    # install pycocotools locally
	python setup.py build_ext --inplace
	rm -rf build

install:
	# install pycocotools to the Python site-packages
	python setup.py build_ext install
	rm -rf build

================================================
FILE: PythonAPI/common/gason.cpp
================================================
// https://github.com/vivkin/gason - pulled January 10, 2016
#include "gason.h"
#include <stdlib.h>

#define JSON_ZONE_SIZE 4096
#define JSON_STACK_SIZE 32

const char *jsonStrError(int err) {
    switch (err) {
#define XX(no, str) \
    case JSON_##no: \
        return str;
        JSON_ERRNO_MAP(XX)
#undef XX
    default:
        return "unknown";
    }
}

void *JsonAllocator::allocate(size_t size) {
    size = (size + 7) & ~7;

    if (head && head->used + size <= JSON_ZONE_SIZE) {
        char *p = (char *)head + head->used;
        head->used += size;
        return p;
    }

    size_t allocSize = sizeof(Zone) + size;
    Zone *zone = (Zone *)malloc(allocSize <= JSON_ZONE_SIZE ? JSON_ZONE_SIZE : allocSize);
    if (zone == nullptr)
        return nullptr;
    zone->used = allocSize;
    if (allocSize <= JSON_ZONE_SIZE || head == nullptr) {
        zone->next = head;
        head = zone;
    } else {
        zone->next = head->next;
        head->next = zone;
    }
    return (char *)zone + sizeof(Zone);
}

void JsonAllocator::deallocate() {
    while (head) {
        Zone *next = head->next;
        free(head);
        head = next;
    }
}

static inline bool isspace(char c) {
    return c == ' ' || (c >= '\t' && c <= '\r');
}

static inline bool isdelim(char c) {
    return c == ',' || c == ':' || c == ']' || c == '}' || isspace(c) || !c;
}

static inline bool isdigit(char c) {
    return c >= '0' && c <= '9';
}

static inline bool isxdigit(char c) {
    return (c >= '0' && c <= '9') || ((c & ~' ') >= 'A' && (c & ~' ') <= 'F');
}

static inline int char2int(char c) {
    if (c <= '9')
        return c - '0';
    return (c & ~' ') - 'A' + 10;
}

static double string2double(char *s, char **endptr) {
    char ch = *s;
    if (ch == '-')
        ++s;

    double result = 0;
    while (isdigit(*s))
        result = (result * 10) + (*s++ - '0');

    if (*s == '.') {
        ++s;

        double fraction = 1;
        while (isdigit(*s)) {
            fraction *= 0.1;
            result += (*s++ - '0') * fraction;
        }
    }

    if (*s == 'e' || *s == 'E') {
        ++s;

        double base = 10;
        if (*s == '+')
            ++s;
        else if (*s == '-') {
            ++s;
            base = 0.1;
        }

        unsigned int exponent = 0;
        while (isdigit(*s))
            exponent = (exponent * 10) + (*s++ - '0');

        double power = 1;
        for (; exponent; exponent >>= 1, base *= base)
            if (exponent & 1)
                power *= base;

        result *= power;
    }

    *endptr = s;
    return ch == '-' ? -result : result;
}

static inline JsonNode *insertAfter(JsonNode *tail, JsonNode *node) {
    if (!tail)
        return node->next = node;
    node->next = tail->next;
    tail->next = node;
    return node;
}

static inline JsonValue listToValue(JsonTag tag, JsonNode *tail) {
    if (tail) {
        auto head = tail->next;
        tail->next = nullptr;
        return JsonValue(tag, head);
    }
    return JsonValue(tag, nullptr);
}

int jsonParse(char *s, char **endptr, JsonValue *value, JsonAllocator &allocator) {
    JsonNode *tails[JSON_STACK_SIZE];
    JsonTag tags[JSON_STACK_SIZE];
    char *keys[JSON_STACK_SIZE];
    JsonValue o;
    int pos = -1;
    bool separator = true;
    JsonNode *node;
    *endptr = s;

    while (*s) {
        while (isspace(*s)) {
            ++s;
            if (!*s) break;
        }
        *endptr = s++;
        switch (**endptr) {
        case '-':
            if (!isdigit(*s) && *s != '.') {
                *endptr = s;
                return JSON_BAD_NUMBER;
            }
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
        case '8':
        case '9':
            o = JsonValue(string2double(*endptr, &s));
            if (!isdelim(*s)) {
                *endptr = s;
                return JSON_BAD_NUMBER;
            }
            break;
        case '"':
            o = JsonValue(JSON_STRING, s);
            for (char *it = s; *s; ++it, ++s) {
                int c = *it = *s;
                if (c == '\\') {
                    c = *++s;
                    switch (c) {
                    case '\\':
                    case '"':
                    case '/':
                        *it = c;
                        break;
                    case 'b':
                        *it = '\b';
                        break;
                    case 'f':
                        *it = '\f';
                        break;
                    case 'n':
                        *it = '\n';
                        break;
                    case 'r':
                        *it = '\r';
                        break;
                    case 't':
                        *it = '\t';
                        break;
                    case 'u':
                        c = 0;
                        for (int i = 0; i < 4; ++i) {
                            if (isxdigit(*++s)) {
                                c = c * 16 + char2int(*s);
                            } else {
                                *endptr = s;
                                return JSON_BAD_STRING;
                            }
                        }
                        if (c < 0x80) {
                            *it = c;
                        } else if (c < 0x800) {
                            *it++ = 0xC0 | (c >> 6);
                            *it = 0x80 | (c & 0x3F);
                        } else {
                            *it++ = 0xE0 | (c >> 12);
                            *it++ = 0x80 | ((c >> 6) & 0x3F);
                            *it = 0x80 | (c & 0x3F);
                        }
                        break;
                    default:
                        *endptr = s;
                        return JSON_BAD_STRING;
                    }
                } else if ((unsigned int)c < ' ' || c == '\x7F') {
                    *endptr = s;
                    return JSON_BAD_STRING;
                } else if (c == '"') {
                    *it = 0;
                    ++s;
                    break;
                }
            }
            if (!isdelim(*s)) {
                *endptr = s;
                return JSON_BAD_STRING;
            }
            break;
        case 't':
            if (!(s[0] == 'r' && s[1] == 'u' && s[2] == 'e' && isdelim(s[3])))
                return JSON_BAD_IDENTIFIER;
            o = JsonValue(JSON_TRUE);
            s += 3;
            break;
        case 'f':
            if (!(s[0] == 'a' && s[1] == 'l' && s[2] == 's' && s[3] == 'e' && isdelim(s[4])))
                return JSON_BAD_IDENTIFIER;
            o = JsonValue(JSON_FALSE);
            s += 4;
            break;
        case 'n':
            if (!(s[0] == 'u' && s[1] == 'l' && s[2] == 'l' && isdelim(s[3])))
                return JSON_BAD_IDENTIFIER;
            o = JsonValue(JSON_NULL);
            s += 3;
            break;
        case ']':
            if (pos == -1)
                return JSON_STACK_UNDERFLOW;
            if (tags[pos] != JSON_ARRAY)
                return JSON_MISMATCH_BRACKET;
            o = listToValue(JSON_ARRAY, tails[pos--]);
            break;
        case '}':
            if (pos == -1)
                return JSON_STACK_UNDERFLOW;
            if (tags[pos] != JSON_OBJECT)
                return JSON_MISMATCH_BRACKET;
            if (keys[pos] != nullptr)
                return JSON_UNEXPECTED_CHARACTER;
            o = listToValue(JSON_OBJECT, tails[pos--]);
            break;
        case '[':
            if (++pos == JSON_STACK_SIZE)
                return JSON_STACK_OVERFLOW;
            tails[pos] = nullptr;
            tags[pos] = JSON_ARRAY;
            keys[pos] = nullptr;
            separator = true;
            continue;
        case '{':
            if (++pos == JSON_STACK_SIZE)
                return JSON_STACK_OVERFLOW;
            tails[pos] = nullptr;
            tags[pos] = JSON_OBJECT;
            keys[pos] = nullptr;
            separator = true;
            continue;
        case ':':
            if (separator || keys[pos] == nullptr)
                return JSON_UNEXPECTED_CHARACTER;
            separator = true;
            continue;
        case ',':
            if (separator || keys[pos] != nullptr)
                return JSON_UNEXPECTED_CHARACTER;
            separator = true;
            continue;
        case '\0':
            continue;
        default:
            return JSON_UNEXPECTED_CHARACTER;
        }

        separator = false;

        if (pos == -1) {
            *endptr = s;
            *value = o;
            return JSON_OK;
        }

        if (tags[pos] == JSON_OBJECT) {
            if (!keys[pos]) {
                if (o.getTag() != JSON_STRING)
                    return JSON_UNQUOTED_KEY;
                keys[pos] = o.toString();
                continue;
            }
            if ((node = (JsonNode *) allocator.allocate(sizeof(JsonNode))) == nullptr)
                return JSON_ALLOCATION_FAILURE;
            tails[pos] = insertAfter(tails[pos], node);
            tails[pos]->key = keys[pos];
            keys[pos] = nullptr;
        } else {
            if ((node = (JsonNode *) allocator.allocate(sizeof(JsonNode) - sizeof(char *))) == nullptr)
                return JSON_ALLOCATION_FAILURE;
            tails[pos] = insertAfter(tails[pos], node);
        }
        tails[pos]->value = o;
    }
    return JSON_BREAKING_BAD;
}


================================================
FILE: PythonAPI/common/gason.h
================================================
// https://github.com/vivkin/gason - pulled January 10, 2016
#pragma once

#include <stdint.h>
#include <stddef.h>
#include <assert.h>

enum JsonTag {
    JSON_NUMBER = 0,
    JSON_STRING,
    JSON_ARRAY,
    JSON_OBJECT,
    JSON_TRUE,
    JSON_FALSE,
    JSON_NULL = 0xF
};

struct JsonNode;

#define JSON_VALUE_PAYLOAD_MASK 0x00007FFFFFFFFFFFULL
#define JSON_VALUE_NAN_MASK 0x7FF8000000000000ULL
#define JSON_VALUE_TAG_MASK 0xF
#define JSON_VALUE_TAG_SHIFT 47

union JsonValue {
    uint64_t ival;
    double fval;

    JsonValue(double x)
        : fval(x) {
    }
    JsonValue(JsonTag tag = JSON_NULL, void *payload = nullptr) {
        assert((uintptr_t)payload <= JSON_VALUE_PAYLOAD_MASK);
        ival = JSON_VALUE_NAN_MASK | ((uint64_t)tag << JSON_VALUE_TAG_SHIFT) | (uintptr_t)payload;
    }
    bool isDouble() const {
        return (int64_t)ival <= (int64_t)JSON_VALUE_NAN_MASK;
    }
    JsonTag getTag() const {
        return isDouble() ? JSON_NUMBER : JsonTag((ival >> JSON_VALUE_TAG_SHIFT) & JSON_VALUE_TAG_MASK);
    }
    uint64_t getPayload() const {
        assert(!isDouble());
        return ival & JSON_VALUE_PAYLOAD_MASK;
    }
    double toNumber() const {
        assert(getTag() == JSON_NUMBER);
        return fval;
    }
    char *toString() const {
        assert(getTag() == JSON_STRING);
        return (char *)getPayload();
    }
    JsonNode *toNode() const {
        assert(getTag() == JSON_ARRAY || getTag() == JSON_OBJECT);
        return (JsonNode *)getPayload();
    }
};

struct JsonNode {
    JsonValue value;
    JsonNode *next;
    char *key;
};

struct JsonIterator {
    JsonNode *p;

    void operator++() {
        p = p->next;
    }
    bool operator!=(const JsonIterator &x) const {
        return p != x.p;
    }
    JsonNode *operator*() const {
        return p;
    }
    JsonNode *operator->() const {
        return p;
    }
};

inline JsonIterator begin(JsonValue o) {
    return JsonIterator{o.toNode()};
}
inline JsonIterator end(JsonValue) {
    return JsonIterator{nullptr};
}

#define JSON_ERRNO_MAP(XX)                           \
    XX(OK, "ok")                                     \
    XX(BAD_NUMBER, "bad number")                     \
    XX(BAD_STRING, "bad string")                     \
    XX(BAD_IDENTIFIER, "bad identifier")             \
    XX(STACK_OVERFLOW, "stack overflow")             \
    XX(STACK_UNDERFLOW, "stack underflow")           \
    XX(MISMATCH_BRACKET, "mismatch bracket")         \
    XX(UNEXPECTED_CHARACTER, "unexpected character") \
    XX(UNQUOTED_KEY, "unquoted key")                 \
    XX(BREAKING_BAD, "breaking bad")                 \
    XX(ALLOCATION_FAILURE, "allocation failure")

enum JsonErrno {
#define XX(no, str) JSON_##no,
    JSON_ERRNO_MAP(XX)
#undef XX
};

const char *jsonStrError(int err);

class JsonAllocator {
    struct Zone {
        Zone *next;
        size_t used;
    } *head = nullptr;

public:
    JsonAllocator() = default;
    JsonAllocator(const JsonAllocator &) = delete;
    JsonAllocator &operator=(const JsonAllocator &) = delete;
    JsonAllocator(JsonAllocator &&x) : head(x.head) {
        x.head = nullptr;
    }
    JsonAllocator &operator=(JsonAllocator &&x) {
        head = x.head;
        x.head = nullptr;
        return *this;
    }
    ~JsonAllocator() {
        deallocate();
    }
    void *allocate(size_t size);
    void deallocate();
};

int jsonParse(char *str, char **endptr, JsonValue *value, JsonAllocator &allocator);


================================================
FILE: PythonAPI/common/maskApi.c
================================================
/**************************************************************************
* Microsoft COCO Toolbox.      version 2.0
* Data, paper, and tutorials available at:  http://mscoco.org/
* Code written by Piotr Dollar and Tsung-Yi Lin, 2015.
* Licensed under the Simplified BSD License [see coco/license.txt]
**************************************************************************/
#include "maskApi.h"
#include <math.h>
#include <stdlib.h>

uint umin( uint a, uint b ) { return (a<b) ? a : b; }
uint umax( uint a, uint b ) { return (a>b) ? a : b; }

void rleInit( RLE *R, siz h, siz w, siz m, uint *cnts ) {
  R->h=h; R->w=w; R->m=m; R->cnts=(m==0)?0:malloc(sizeof(uint)*m);
  siz j; if(cnts) for(j=0; j<m; j++) R->cnts[j]=cnts[j];
}

void rleFree( RLE *R ) {
  free(R->cnts); R->cnts=0;
}

void rlesInit( RLE **R, siz n ) {
  siz i; *R = (RLE*) malloc(sizeof(RLE)*n);
  for(i=0; i<n; i++) rleInit((*R)+i,0,0,0,0);
}

void rlesFree( RLE **R, siz n ) {
  siz i; for(i=0; i<n; i++) rleFree((*R)+i); free(*R); *R=0;
}

void rleEncode( RLE *R, const byte *M, siz h, siz w, siz n ) {
  siz i, j, k, a=w*h; uint c, *cnts; byte p;
  cnts = malloc(sizeof(uint)*(a+1));
  for(i=0; i<n; i++) {
    const byte *T=M+a*i; k=0; p=0; c=0;
    for(j=0; j<a; j++) { if(T[j]!=p) { cnts[k++]=c; c=0; p=T[j]; } c++; }
    cnts[k++]=c; rleInit(R+i,h,w,k,cnts);
  }
  free(cnts);
}

void rleDecode( const RLE *R, byte *M, siz n ) {
  siz i, j, k; for( i=0; i<n; i++ ) {
    byte v=0; for( j=0; j<R[i].m; j++ ) {
      for( k=0; k<R[i].cnts[j]; k++ ) *(M++)=v; v=!v; }}
}

void rleMerge( const RLE *R, RLE *M, siz n, int intersect ) {
  uint *cnts, c, ca, cb, cc, ct; int v, va, vb, vp;
  siz i, a, b, h=R[0].h, w=R[0].w, m=R[0].m; RLE A, B;
  if(n==0) { rleInit(M,0,0,0,0); return; }
  if(n==1) { rleInit(M,h,w,m,R[0].cnts); return; }
  cnts = malloc(sizeof(uint)*(h*w+1));
  for( a=0; a<m; a++ ) cnts[a]=R[0].cnts[a];
  for( i=1; i<n; i++ ) {
    B=R[i]; if(B.h!=h||B.w!=w) { h=w=m=0; break; }
    rleInit(&A,h,w,m,cnts); ca=A.cnts[0]; cb=B.cnts[0];
    v=va=vb=0; m=0; a=b=1; cc=0; ct=1;
    while( ct>0 ) {
      c=umin(ca,cb); cc+=c; ct=0;
      ca-=c; if(!ca && a<A.m) { ca=A.cnts[a++]; va=!va; } ct+=ca;
      cb-=c; if(!cb && b<B.m) { cb=B.cnts[b++]; vb=!vb; } ct+=cb;
      vp=v; if(intersect) v=va&&vb; else v=va||vb;
      if( v!=vp||ct==0 ) { cnts[m++]=cc; cc=0; }
    }
    rleFree(&A);
  }
  rleInit(M,h,w,m,cnts); free(cnts);
}

void rleArea( const RLE *R, siz n, uint *a ) {
  siz i, j; for( i=0; i<n; i++ ) {
    a[i]=0; for( j=1; j<R[i].m; j+=2 ) a[i]+=R[i].cnts[j]; }
}

void rleIou( RLE *dt, RLE *gt, siz m, siz n, byte *iscrowd, double *o ) {
  siz g, d; BB db, gb; int crowd;
  db=malloc(sizeof(double)*m*4); rleToBbox(dt,db,m);
  gb=malloc(sizeof(double)*n*4); rleToBbox(gt,gb,n);
  bbIou(db,gb,m,n,iscrowd,o); free(db); free(gb);
  for( g=0; g<n; g++ ) for( d=0; d<m; d++ ) if(o[g*m+d]>0) {
    crowd=iscrowd!=NULL && iscrowd[g];
    if(dt[d].h!=gt[g].h || dt[d].w!=gt[g].w) { o[g*m+d]=-1; continue; }
    siz ka, kb, a, b; uint c, ca, cb, ct, i, u; int va, vb;
    ca=dt[d].cnts[0]; ka=dt[d].m; va=vb=0;
    cb=gt[g].cnts[0]; kb=gt[g].m; a=b=1; i=u=0; ct=1;
    while( ct>0 ) {
      c=umin(ca,cb); if(va||vb) { u+=c; if(va&&vb) i+=c; } ct=0;
      ca-=c; if(!ca && a<ka) { ca=dt[d].cnts[a++]; va=!va; } ct+=ca;
      cb-=c; if(!cb && b<kb) { cb=gt[g].cnts[b++]; vb=!vb; } ct+=cb;
    }
    if(i==0) u=1; else if(crowd) rleArea(dt+d,1,&u);
    o[g*m+d] = (double)i/(double)u;
  }
}

void rleNms( RLE *dt, siz n, uint *keep, double thr ) {
  siz i, j; double u;
  for( i=0; i<n; i++ ) keep[i]=1;
  for( i=0; i<n; i++ ) if(keep[i]) {
    for( j=i+1; j<n; j++ ) if(keep[j]) {
      rleIou(dt+i,dt+j,1,1,0,&u);
      if(u>thr) keep[j]=0;
    }
  }
}

void bbIou( BB dt, BB gt, siz m, siz n, byte *iscrowd, double *o ) {
  double h, w, i, u, ga, da; siz g, d; int crowd;
  for( g=0; g<n; g++ ) {
    BB G=gt+g*4; ga=G[2]*G[3]; crowd=iscrowd!=NULL && iscrowd[g];
    for( d=0; d<m; d++ ) {
      BB D=dt+d*4; da=D[2]*D[3]; o[g*m+d]=0;
      w=fmin(D[2]+D[0],G[2]+G[0])-fmax(D[0],G[0]); if(w<=0) continue;
      h=fmin(D[3]+D[1],G[3]+G[1])-fmax(D[1],G[1]); if(h<=0) continue;
      i=w*h; u = crowd ? da : da+ga-i; o[g*m+d]=i/u;
    }
  }
}

void bbNms( BB dt, siz n, uint *keep, double thr ) {
  siz i, j; double u;
  for( i=0; i<n; i++ ) keep[i]=1;
  for( i=0; i<n; i++ ) if(keep[i]) {
    for( j=i+1; j<n; j++ ) if(keep[j]) {
      bbIou(dt+i*4,dt+j*4,1,1,0,&u);
      if(u>thr) keep[j]=0;
    }
  }
}

void rleToBbox( const RLE *R, BB bb, siz n ) {
  siz i; for( i=0; i<n; i++ ) {
    uint h, w, x, y, xs, ys, xe, ye, xp, cc, t; siz j, m;
    h=(uint)R[i].h; w=(uint)R[i].w; m=R[i].m;
    m=((siz)(m/2))*2; xs=w; ys=h; xe=ye=0; cc=0;
    if(m==0) { bb[4*i+0]=bb[4*i+1]=bb[4*i+2]=bb[4*i+3]=0; continue; }
    for( j=0; j<m; j++ ) {
      cc+=R[i].cnts[j]; t=cc-j%2; y=t%h; x=(t-y)/h;
      if(j%2==0) xp=x; else if(xp<x) { ys=0; ye=h-1; }
      xs=umin(xs,x); xe=umax(xe,x); ys=umin(ys,y); ye=umax(ye,y);
    }
    bb[4*i+0]=xs; bb[4*i+2]=xe-xs+1;
    bb[4*i+1]=ys; bb[4*i+3]=ye-ys+1;
  }
}

void rleFrBbox( RLE *R, const BB bb, siz h, siz w, siz n ) {
  siz i; for( i=0; i<n; i++ ) {
    double xs=bb[4*i+0], xe=xs+bb[4*i+2];
    double ys=bb[4*i+1], ye=ys+bb[4*i+3];
    double xy[8] = {xs,ys,xs,ye,xe,ye,xe,ys};
    rleFrPoly( R+i, xy, 4, h, w );
  }
}

int uintCompare(const void *a, const void *b) {
  uint c=*((uint*)a), d=*((uint*)b); return c>d?1:c<d?-1:0;
}

void rleFrPoly( RLE *R, const double *xy, siz k, siz h, siz w ) {
  /* upsample and get discrete points densely along entire boundary */
  siz j, m=0; double scale=5; int *x, *y, *u, *v; uint *a, *b;
  x=malloc(sizeof(int)*(k+1)); y=malloc(sizeof(int)*(k+1));
  for(j=0; j<k; j++) x[j]=(int)(scale*xy[j*2+0]+.5); x[k]=x[0];
  for(j=0; j<k; j++) y[j]=(int)(scale*xy[j*2+1]+.5); y[k]=y[0];
  for(j=0; j<k; j++) m+=umax(abs(x[j]-x[j+1]),abs(y[j]-y[j+1]))+1;
  u=malloc(sizeof(int)*m); v=malloc(sizeof(int)*m); m=0;
  for( j=0; j<k; j++ ) {
    int xs=x[j], xe=x[j+1], ys=y[j], ye=y[j+1], dx, dy, t, d;
    int flip; double s; dx=abs(xe-xs); dy=abs(ys-ye);
    flip = (dx>=dy && xs>xe) || (dx<dy && ys>ye);
    if(flip) { t=xs; xs=xe; xe=t; t=ys; ys=ye; ye=t; }
    s = dx>=dy ? (double)(ye-ys)/dx : (double)(xe-xs)/dy;
    if(dx>=dy) for( d=0; d<=dx; d++ ) {
      t=flip?dx-d:d; u[m]=t+xs; v[m]=(int)(ys+s*t+.5); m++;
    } else for( d=0; d<=dy; d++ ) {
      t=flip?dy-d:d; v[m]=t+ys; u[m]=(int)(xs+s*t+.5); m++;
    }
  }
  /* get points along y-boundary and downsample */
  free(x); free(y); k=m; m=0; double xd, yd;
  x=malloc(sizeof(int)*k); y=malloc(sizeof(int)*k);
  for( j=1; j<k; j++ ) if(u[j]!=u[j-1]) {
    xd=(double)(u[j]<u[j-1]?u[j]:u[j]-1); xd=(xd+.5)/scale-.5;
    if( floor(xd)!=xd || xd<0 || xd>w-1 ) continue;
    yd=(double)(v[j]<v[j-1]?v[j]:v[j-1]); yd=(yd+.5)/scale-.5;
    if(yd<0) yd=0; else if(yd>h) yd=h; yd=ceil(yd);
    x[m]=(int) xd; y[m]=(int) yd; m++;
  }
  /* compute rle encoding given y-boundary points */
  k=m; a=malloc(sizeof(uint)*(k+1));
  for( j=0; j<k; j++ ) a[j]=(uint)(x[j]*(int)(h)+y[j]);
  a[k++]=(uint)(h*w); free(u); free(v); free(x); free(y);
  qsort(a,k,sizeof(uint),uintCompare); uint p=0;
  for( j=0; j<k; j++ ) { uint t=a[j]; a[j]-=p; p=t; }
  b=malloc(sizeof(uint)*k); j=m=0; b[m++]=a[j++];
  while(j<k) if(a[j]>0) b[m++]=a[j++]; else {
    j++; if(j<k) b[m-1]+=a[j++]; }
  rleInit(R,h,w,m,b); free(a); free(b);
}

char* rleToString( const RLE *R ) {
  /* Similar to LEB128 but using 6 bits/char and ascii chars 48-111. */
  siz i, m=R->m, p=0; long x; int more;
  char *s=malloc(sizeof(char)*m*6);
  for( i=0; i<m; i++ ) {
    x=(long) R->cnts[i]; if(i>2) x-=(long) R->cnts[i-2]; more=1;
    while( more ) {
      char c=x & 0x1f; x >>= 5; more=(c & 0x10) ? x!=-1 : x!=0;
      if(more) c |= 0x20; c+=48; s[p++]=c;
    }
  }
  s[p]=0; return s;
}

void rleFrString( RLE *R, char *s, siz h, siz w ) {
  siz m=0, p=0, k; long x; int more; uint *cnts;
  while( s[m] ) m++; cnts=malloc(sizeof(uint)*m); m=0;
  while( s[p] ) {
    x=0; k=0; more=1;
    while( more ) {
      char c=s[p]-48; x |= (c & 0x1f) << 5*k;
      more = c & 0x20; p++; k++;
      if(!more && (c & 0x10)) x |= -1 << 5*k;
    }
    if(m>2) x+=(long) cnts[m-2]; cnts[m++]=(uint) x;
  }
  rleInit(R,h,w,m,cnts); free(cnts);
}


================================================
FILE: PythonAPI/common/maskApi.h
================================================
/**************************************************************************
* Microsoft COCO Toolbox.      version 2.0
* Data, paper, and tutorials available at:  http://mscoco.org/
* Code written by Piotr Dollar and Tsung-Yi Lin, 2015.
* Licensed under the Simplified BSD License [see coco/license.txt]
**************************************************************************/
#pragma once

typedef unsigned int uint;
typedef unsigned long siz;
typedef unsigned char byte;
typedef double* BB;
typedef struct { siz h, w, m; uint *cnts; } RLE;

/* Initialize/destroy RLE. */
void rleInit( RLE *R, siz h, siz w, siz m, uint *cnts );
void rleFree( RLE *R );

/* Initialize/destroy RLE array. */
void rlesInit( RLE **R, siz n );
void rlesFree( RLE **R, siz n );

/* Encode binary masks using RLE. */
void rleEncode( RLE *R, const byte *mask, siz h, siz w, siz n );

/* Decode binary masks encoded via RLE. */
void rleDecode( const RLE *R, byte *mask, siz n );

/* Compute union or intersection of encoded masks. */
void rleMerge( const RLE *R, RLE *M, siz n, int intersect );

/* Compute area of encoded masks. */
void rleArea( const RLE *R, siz n, uint *a );

/* Compute intersection over union between masks. */
void rleIou( RLE *dt, RLE *gt, siz m, siz n, byte *iscrowd, double *o );

/* Compute non-maximum suppression between bounding masks */
void rleNms( RLE *dt, siz n, uint *keep, double thr );

/* Compute intersection over union between bounding boxes. */
void bbIou( BB dt, BB gt, siz m, siz n, byte *iscrowd, double *o );

/* Compute non-maximum suppression between bounding boxes */
void bbNms( BB dt, siz n, uint *keep, double thr );

/* Get bounding boxes surrounding encoded masks. */
void rleToBbox( const RLE *R, BB bb, siz n );

/* Convert bounding boxes to encoded masks. */
void rleFrBbox( RLE *R, const BB bb, siz h, siz w, siz n );

/* Convert polygon to encoded mask. */
void rleFrPoly( RLE *R, const double *xy, siz k, siz h, siz w );

/* Get compressed string representation of encoded mask. */
char* rleToString( const RLE *R );

/* Convert from compressed string representation of encoded mask. */
void rleFrString( RLE *R, char *s, siz h, siz w );


================================================
FILE: PythonAPI/pysobatools/__init__.py
================================================
__author__ = 'tylin'


================================================
FILE: PythonAPI/pysobatools/_mask.c
================================================
/* Generated by Cython 0.29.13 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
    #error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_13"
#define CYTHON_HEX_VERSION 0x001D0DF0
#define CYTHON_FUTURE_DIVISION 0
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#define __PYX_COMMA ,
#ifndef HAVE_LONG_LONG
  #if PY_VERSION_HEX >= 0x02070000
    #define HAVE_LONG_LONG
  #endif
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #undef CYTHON_USE_TYPE_SLOTS
  #define CYTHON_USE_TYPE_SLOTS 0
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #if PY_VERSION_HEX < 0x03050000
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #undef CYTHON_USE_UNICODE_INTERNALS
  #define CYTHON_USE_UNICODE_INTERNALS 0
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #undef CYTHON_AVOID_BORROWED_REFS
  #define CYTHON_AVOID_BORROWED_REFS 1
  #undef CYTHON_ASSUME_SAFE_MACROS
  #define CYTHON_ASSUME_SAFE_MACROS 0
  #undef CYTHON_UNPACK_METHODS
  #define CYTHON_UNPACK_METHODS 0
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#elif defined(PYSTON_VERSION)
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #undef CYTHON_USE_PYTYPE_LOOKUP
  #define CYTHON_USE_PYTYPE_LOOKUP 0
  #undef CYTHON_USE_ASYNC_SLOTS
  #define CYTHON_USE_ASYNC_SLOTS 0
  #undef CYTHON_USE_PYLIST_INTERNALS
  #define CYTHON_USE_PYLIST_INTERNALS 0
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #undef CYTHON_USE_UNICODE_WRITER
  #define CYTHON_USE_UNICODE_WRITER 0
  #undef CYTHON_USE_PYLONG_INTERNALS
  #define CYTHON_USE_PYLONG_INTERNALS 0
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #undef CYTHON_FAST_THREAD_STATE
  #define CYTHON_FAST_THREAD_STATE 0
  #undef CYTHON_FAST_PYCALL
  #define CYTHON_FAST_PYCALL 0
  #undef CYTHON_PEP489_MULTI_PHASE_INIT
  #define CYTHON_PEP489_MULTI_PHASE_INIT 0
  #undef CYTHON_USE_TP_FINALIZE
  #define CYTHON_USE_TP_FINALIZE 0
  #undef CYTHON_USE_DICT_VERSIONS
  #define CYTHON_USE_DICT_VERSIONS 0
  #undef CYTHON_USE_EXC_INFO_STACK
  #define CYTHON_USE_EXC_INFO_STACK 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_PYSTON 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
  #ifndef CYTHON_USE_TYPE_SLOTS
    #define CYTHON_USE_TYPE_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYTYPE_LOOKUP
    #define CYTHON_USE_PYTYPE_LOOKUP 0
  #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
    #define CYTHON_USE_PYTYPE_LOOKUP 1
  #endif
  #if PY_MAJOR_VERSION < 3
    #undef CYTHON_USE_ASYNC_SLOTS
    #define CYTHON_USE_ASYNC_SLOTS 0
  #elif !defined(CYTHON_USE_ASYNC_SLOTS)
    #define CYTHON_USE_ASYNC_SLOTS 1
  #endif
  #if PY_VERSION_HEX < 0x02070000
    #undef CYTHON_USE_PYLONG_INTERNALS
    #define CYTHON_USE_PYLONG_INTERNALS 0
  #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
    #define CYTHON_USE_PYLONG_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_PYLIST_INTERNALS
    #define CYTHON_USE_PYLIST_INTERNALS 1
  #endif
  #ifndef CYTHON_USE_UNICODE_INTERNALS
    #define CYTHON_USE_UNICODE_INTERNALS 1
  #endif
  #if PY_VERSION_HEX < 0x030300F0
    #undef CYTHON_USE_UNICODE_WRITER
    #define CYTHON_USE_UNICODE_WRITER 0
  #elif !defined(CYTHON_USE_UNICODE_WRITER)
    #define CYTHON_USE_UNICODE_WRITER 1
  #endif
  #ifndef CYTHON_AVOID_BORROWED_REFS
    #define CYTHON_AVOID_BORROWED_REFS 0
  #endif
  #ifndef CYTHON_ASSUME_SAFE_MACROS
    #define CYTHON_ASSUME_SAFE_MACROS 1
  #endif
  #ifndef CYTHON_UNPACK_METHODS
    #define CYTHON_UNPACK_METHODS 1
  #endif
  #ifndef CYTHON_FAST_THREAD_STATE
    #define CYTHON_FAST_THREAD_STATE 1
  #endif
  #ifndef CYTHON_FAST_PYCALL
    #define CYTHON_FAST_PYCALL 1
  #endif
  #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
    #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
  #endif
  #ifndef CYTHON_USE_TP_FINALIZE
    #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
  #endif
  #ifndef CYTHON_USE_DICT_VERSIONS
    #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
  #endif
  #ifndef CYTHON_USE_EXC_INFO_STACK
    #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
  #endif
#endif
#if !defined(CYTHON_FAST_PYCCALL)
#define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
  #ifdef SIZEOF_VOID_P
    enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
  #endif
#endif
#ifndef __has_attribute
  #define __has_attribute(x) 0
#endif
#ifndef __has_cpp_attribute
  #define __has_cpp_attribute(x) 0
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_MAYBE_UNUSED_VAR
#  if defined(__cplusplus)
     template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
#  else
#    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
#  endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
#ifdef _MSC_VER
    #ifndef _MSC_STDINT_H_
        #if _MSC_VER < 1300
           typedef unsigned char     uint8_t;
           typedef unsigned int      uint32_t;
        #else
           typedef unsigned __int8   uint8_t;
           typedef unsigned __int32  uint32_t;
        #endif
    #endif
#else
   #include <stdint.h>
#endif
#ifndef CYTHON_FALLTHROUGH
  #if defined(__cplusplus) && __cplusplus >= 201103L
    #if __has_cpp_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH [[fallthrough]]
    #elif __has_cpp_attribute(clang::fallthrough)
      #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
    #elif __has_cpp_attribute(gnu::fallthrough)
      #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
    #endif
  #endif
  #ifndef CYTHON_FALLTHROUGH
    #if __has_attribute(fallthrough)
      #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
    #else
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
  #if defined(__clang__ ) && defined(__apple_build_version__)
    #if __apple_build_version__ < 7000000
      #undef  CYTHON_FALLTHROUGH
      #define CYTHON_FALLTHROUGH
    #endif
  #endif
#endif

#ifndef CYTHON_INLINE
  #if defined(__clang__)
    #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
  #elif defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#else
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
#endif
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#ifndef METH_STACKLESS
  #define METH_STACKLESS 0
#endif
#if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
  #ifndef METH_FASTCALL
     #define METH_FASTCALL 0x80
  #endif
  typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
  typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
                                                          Py_ssize_t nargs, PyObject *kwnames);
#else
  #define __Pyx_PyCFunctionFast _PyCFunctionFast
  #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
#endif
#if CYTHON_FAST_PYCCALL
#define __Pyx_PyFastCFunction_Check(func)\
    ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
#else
#define __Pyx_PyFastCFunction_Check(func) 0
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
  #define PyMem_RawMalloc(n)           PyMem_Malloc(n)
  #define PyMem_RawRealloc(p, n)       PyMem_Realloc(p, n)
  #define PyMem_RawFree(p)             PyMem_Free(p)
#endif
#if CYTHON_COMPILING_IN_PYSTON
  #define __Pyx_PyCode_HasFreeVars(co)  PyCode_HasFreeVars(co)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
#else
  #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
  #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
#endif
#if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#elif PY_VERSION_HEX >= 0x03060000
  #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
#elif PY_VERSION_HEX >= 0x03000000
  #define __Pyx_PyThreadState_Current PyThreadState_GET()
#else
  #define __Pyx_PyThreadState_Current _PyThreadState_Current
#endif
#if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
#include "pythread.h"
#define Py_tss_NEEDS_INIT 0
typedef int Py_tss_t;
static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  *key = PyThread_create_key();
  return 0;
}
static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
  *key = Py_tss_NEEDS_INIT;
  return key;
}
static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  PyObject_Free(key);
}
static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  return *key != Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  PyThread_delete_key(*key);
  *key = Py_tss_NEEDS_INIT;
}
static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  return PyThread_set_key_value(*key, value);
}
static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  return PyThread_get_key_value(*key);
}
#endif
#if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
#define __Pyx_PyDict_NewPresized(n)  ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
#else
#define __Pyx_PyDict_NewPresized(n)  PyDict_New()
#endif
#if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif
#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
#define __Pyx_PyDict_GetItemStr(dict, name)  _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
#else
#define __Pyx_PyDict_GetItemStr(dict, name)  PyDict_GetItem(dict, name)
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   PyUnicode_MAX_CHAR_VALUE(u)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  PyUnicode_WRITE(k, d, i, ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define PyUnicode_1BYTE_KIND  1
  #define PyUnicode_2BYTE_KIND  2
  #define PyUnicode_4BYTE_KIND  4
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u)   ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_WRITE(k, d, i, ch)  (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
  #define PyObject_Unicode             PyObject_Str
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#if CYTHON_ASSUME_SAFE_MACROS
  #define __Pyx_PySequence_SIZE(seq)  Py_SIZE(seq)
#else
  #define __Pyx_PySequence_SIZE(seq)  PySequence_Size(seq)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if CYTHON_USE_ASYNC_SLOTS
  #if PY_VERSION_HEX >= 0x030500B1
    #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
    #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
  #else
    #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
  #endif
#else
  #define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef __Pyx_PyAsyncMethodsStruct
    typedef struct {
        unaryfunc am_await;
        unaryfunc am_aiter;
        unaryfunc am_anext;
    } __Pyx_PyAsyncMethodsStruct;
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__pysobatools___mask
#define __PYX_HAVE_API__pysobatools___mask
/* Early includes */
#include <string.h>
#include <stdio.h>
#include "numpy/arrayobject.h"
#include "numpy/ufuncobject.h"
#include <stdlib.h>
#include "maskApi.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
#define CYTHON_WITHOUT_ASSERTIONS
#endif

typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
    return (size_t) i < (size_t) limit;
}
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER)
    #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyBytes_AsWritableString(s)     ((char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableSString(s)    ((signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsWritableUString(s)    ((unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsString(s)     ((const char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsSString(s)    ((const signed char*) PyBytes_AS_STRING(s))
#define __Pyx_PyBytes_AsUString(s)    ((const unsigned char*) PyBytes_AS_STRING(s))
#define __Pyx_PyObject_AsWritableString(s)    ((char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsWritableUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsSString(s)    ((const signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((const unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
#define __Pyx_PySequence_Tuple(obj)\
    (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_ASSUME_SAFE_MACROS
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */
static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }

static PyObject *__pyx_m = NULL;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_cython_runtime = NULL;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;

/* Header.proto */
#if !defined(CYTHON_CCOMPLEX)
  #if defined(__cplusplus)
    #define CYTHON_CCOMPLEX 1
  #elif defined(_Complex_I)
    #define CYTHON_CCOMPLEX 1
  #else
    #define CYTHON_CCOMPLEX 0
  #endif
#endif
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #include <complex>
  #else
    #include <complex.h>
  #endif
#endif
#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
  #undef _Complex_I
  #define _Complex_I 1.0fj
#endif


static const char *__pyx_f[] = {
  "pysobatools/_mask.pyx",
  "stringsource",
  "__init__.pxd",
  "type.pxd",
};
/* BufferFormatStructs.proto */
#define IS_UNSIGNED(type) (((type) -1) > 0)
struct __Pyx_StructField_;
#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
typedef struct {
  const char* name;
  struct __Pyx_StructField_* fields;
  size_t size;
  size_t arraysize[8];
  int ndim;
  char typegroup;
  char is_unsigned;
  int flags;
} __Pyx_TypeInfo;
typedef struct __Pyx_StructField_ {
  __Pyx_TypeInfo* type;
  const char* name;
  size_t offset;
} __Pyx_StructField;
typedef struct {
  __Pyx_StructField* field;
  size_t parent_offset;
} __Pyx_BufFmt_StackElem;
typedef struct {
  __Pyx_StructField root;
  __Pyx_BufFmt_StackElem* head;
  size_t fmt_offset;
  size_t new_count, enc_count;
  size_t struct_alignment;
  int is_complex;
  char enc_type;
  char new_packmode;
  char enc_packmode;
  char is_valid_array;
} __Pyx_BufFmt_Context;


/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":776
 * # in Cython to enable them only on the right systems.
 * 
 * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 */
typedef npy_int8 __pyx_t_5numpy_int8_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":777
 * 
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t
 */
typedef npy_int16 __pyx_t_5numpy_int16_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":778
 * ctypedef npy_int8       int8_t
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_int64      int64_t
 * #ctypedef npy_int96      int96_t
 */
typedef npy_int32 __pyx_t_5numpy_int32_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":779
 * ctypedef npy_int16      int16_t
 * ctypedef npy_int32      int32_t
 * ctypedef npy_int64      int64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_int96      int96_t
 * #ctypedef npy_int128     int128_t
 */
typedef npy_int64 __pyx_t_5numpy_int64_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":783
 * #ctypedef npy_int128     int128_t
 * 
 * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 */
typedef npy_uint8 __pyx_t_5numpy_uint8_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":784
 * 
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t
 */
typedef npy_uint16 __pyx_t_5numpy_uint16_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":785
 * ctypedef npy_uint8      uint8_t
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uint64     uint64_t
 * #ctypedef npy_uint96     uint96_t
 */
typedef npy_uint32 __pyx_t_5numpy_uint32_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":786
 * ctypedef npy_uint16     uint16_t
 * ctypedef npy_uint32     uint32_t
 * ctypedef npy_uint64     uint64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_uint96     uint96_t
 * #ctypedef npy_uint128    uint128_t
 */
typedef npy_uint64 __pyx_t_5numpy_uint64_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":790
 * #ctypedef npy_uint128    uint128_t
 * 
 * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
 * ctypedef npy_float64    float64_t
 * #ctypedef npy_float80    float80_t
 */
typedef npy_float32 __pyx_t_5numpy_float32_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":791
 * 
 * ctypedef npy_float32    float32_t
 * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
 * #ctypedef npy_float80    float80_t
 * #ctypedef npy_float128   float128_t
 */
typedef npy_float64 __pyx_t_5numpy_float64_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":800
 * # The int types are mapped a bit surprising --
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t
 */
typedef npy_long __pyx_t_5numpy_int_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":801
 * # numpy.int corresponds to 'l' and numpy.long to 'q'
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longlong   longlong_t
 * 
 */
typedef npy_longlong __pyx_t_5numpy_long_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":802
 * ctypedef npy_long       int_t
 * ctypedef npy_longlong   long_t
 * ctypedef npy_longlong   longlong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_ulong      uint_t
 */
typedef npy_longlong __pyx_t_5numpy_longlong_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":804
 * ctypedef npy_longlong   longlong_t
 * 
 * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t
 */
typedef npy_ulong __pyx_t_5numpy_uint_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":805
 * 
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 */
typedef npy_ulonglong __pyx_t_5numpy_ulong_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":806
 * ctypedef npy_ulong      uint_t
 * ctypedef npy_ulonglong  ulong_t
 * ctypedef npy_ulonglong  ulonglong_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_intp       intp_t
 */
typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":808
 * ctypedef npy_ulonglong  ulonglong_t
 * 
 * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
 * ctypedef npy_uintp      uintp_t
 * 
 */
typedef npy_intp __pyx_t_5numpy_intp_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":809
 * 
 * ctypedef npy_intp       intp_t
 * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_double     float_t
 */
typedef npy_uintp __pyx_t_5numpy_uintp_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":811
 * ctypedef npy_uintp      uintp_t
 * 
 * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t
 */
typedef npy_double __pyx_t_5numpy_float_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":812
 * 
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
 * ctypedef npy_longdouble longdouble_t
 * 
 */
typedef npy_double __pyx_t_5numpy_double_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":813
 * ctypedef npy_double     float_t
 * ctypedef npy_double     double_t
 * ctypedef npy_longdouble longdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cfloat      cfloat_t
 */
typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< float > __pyx_t_float_complex;
  #else
    typedef float _Complex __pyx_t_float_complex;
  #endif
#else
    typedef struct { float real, imag; } __pyx_t_float_complex;
#endif
static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);

/* Declarations.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    typedef ::std::complex< double > __pyx_t_double_complex;
  #else
    typedef double _Complex __pyx_t_double_complex;
  #endif
#else
    typedef struct { double real, imag; } __pyx_t_double_complex;
#endif
static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);


/*--- Type declarations ---*/
struct __pyx_obj_11pysobatools_5_mask_RLEs;
struct __pyx_obj_11pysobatools_5_mask_Masks;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":815
 * ctypedef npy_longdouble longdouble_t
 * 
 * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t
 */
typedef npy_cfloat __pyx_t_5numpy_cfloat_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":816
 * 
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
 * ctypedef npy_clongdouble clongdouble_t
 * 
 */
typedef npy_cdouble __pyx_t_5numpy_cdouble_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":817
 * ctypedef npy_cfloat      cfloat_t
 * ctypedef npy_cdouble     cdouble_t
 * ctypedef npy_clongdouble clongdouble_t             # <<<<<<<<<<<<<<
 * 
 * ctypedef npy_cdouble     complex_t
 */
typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;

/* "../../miniconda/envs/py36/lib/python3.6/site-packages/Cython/Includes/numpy/__init__.pxd":819
 * ctypedef npy_clongdouble clongdouble_t
 * 
 * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
 * 
 * cdef inline object PyArray_MultiIterNew1(a):
 */
typedef npy_cdouble __pyx_t_5numpy_complex_t;

/* "pysobatools/_mask.pyx":56
 * # python class to wrap RLE array in C
 * # the class handles the memory allocation and deallocation
 * cdef class RLEs:             # <<<<<<<<<<<<<<
 *     cdef RLE *_R
 *     cdef siz _n
 */
struct __pyx_obj_11pysobatools_5_mask_RLEs {
  PyObject_HEAD
  RLE *_R;
  siz _n;
};


/* "pysobatools/_mask.pyx":77
 * # python class to wrap Mask array in C
 * # the class handles the memory allocation and deallocation
 * cdef class Masks:             # <<<<<<<<<<<<<<
 *     cdef byte *_mask
 *     cdef siz _h
 */
struct __pyx_obj_11pysobatools_5_mask_Masks {
  PyObject_HEAD
  byte *_mask;
  siz _h;
  siz _w;
  siz _n;
};


/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_USE_TYPE_SLOTS
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* IncludeStringH.proto */
#include <string.h>

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

/* PyCFunctionFastCall.proto */
#if CYTHON_FAST_PYCCALL
static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
#else
#define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
#endif

/* PyFunctionFastCall.proto */
#if CYTHON_FAST_PYCALL
#define __Pyx_PyFunction_FastCall(func, args, nargs)\
    __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
#if 1 || PY_VERSION_HEX < 0x030600B1
static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
#else
#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
#endif
#define __Pyx_BUILD_ASSERT_EXPR(cond)\
    (sizeof(char [1 - 2*!(cond)]) - 1)
#ifndef Py_MEMBER_SIZE
#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
#endif
  static size_t __pyx_pyframe_localsplus_offset = 0;
  #include "frameobject.h"
  #define __Pxy_PyFrame_Initialize_Offsets()\
    ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
     (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
  #define __Pyx_PyFrame_GetLocalsplus(frame)\
    (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
#endif

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* PyThreadStateGet.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = __Pyx_PyThreadState_Current;
#define __Pyx_PyErr_Occurred()  __pyx_tstate->curexc_type
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#define __Pyx_PyErr_Occurred()  PyErr_Occurred()
#endif

/* PyErrFetchRestore.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
#else
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#endif
#else
#define __Pyx_PyErr_Clear() PyErr_Clear()
#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestoreInState(tstate, type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchInState(tstate, type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* ExtTypeTest.proto */
static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);

/* ArgTypeTest.proto */
#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
    ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
        __Pyx__ArgTypeTest(obj, type, name, exact))
static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact);

/* ListAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* PyIntBinop.proto */
#if !CYTHON_COMPILING_IN_PYPY
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* PyIntCompare.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace);

/* PyDictVersioning.proto */
#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
#define __PYX_DICT_VERSION_INIT  ((PY_UINT64_T) -1)
#define __PYX_GET_DICT_VERSION(dict)  (((PyDictObject*)(dict))->ma_version_tag)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
    (version_var) = __PYX_GET_DICT_VERSION(dict);\
    (cache_var) = (value);
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
        (VAR) = __pyx_dict_cached_value;\
    } else {\
        (VAR) = __pyx_dict_cached_value = (LOOKUP);\
        __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
    }\
}
static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
#else
#define __PYX_GET_DICT_VERSION(dict)  (0)
#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP)  (VAR) = (LOOKUP);
#endif

/* GetModuleGlobalName.proto */
#if CYTHON_USE_DICT_VERSIONS
#define __Pyx_GetModuleGlobalName(var, name)  {\
    static PY_UINT64_T __pyx_dict_version = 0;\
    static PyObject *__pyx_dict_cached_value = NULL;\
    (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
        (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
        __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
#define __Pyx_GetModuleGlobalNameUncached(var, name)  {\
    PY_UINT64_T __pyx_dict_version;\
    PyObject *__pyx_dict_cached_value;\
    (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
}
static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
#else
#define __Pyx_GetModuleGlobalName(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
#define __Pyx_GetModuleGlobalNameUncached(var, name)  (var) = __Pyx__GetModuleGlobalName(name)
static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
#endif

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key);
#define __Pyx_PyObject_Dict_GetItem(obj, name)\
    (likely(PyDict_CheckExact(obj)) ?\
     __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name))
#else
#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#define __Pyx_PyObject_Dict_GetItem(obj, name)  PyObject_GetItem(obj, name)
#endif

/* PyObjectCall2Args.proto */
static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* IsLittleEndian.proto */
static CYTHON_INLINE int __Pyx_Is_Little_Endian(void);

/* BufferFormatCheck.proto */
static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
                              __Pyx_BufFmt_StackElem* stack,
                              __Pyx_TypeInfo* type);

/* BufferGetAndValidate.proto */
#define __Pyx_GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack)\
    ((obj == Py_None || obj == NULL) ?\
    (__Pyx_ZeroBuffer(buf), 0) :\
    __Pyx__GetBufferAndValidate(buf, obj, dtype, flags, nd, cast, stack))
static int  __Pyx__GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
    __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
static void __Pyx_ZeroBuffer(Py_buffer* buf);
static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
static Py_ssize_t __Pyx_minusones[] = { -1, -1, -1, -1, -1, -1, -1, -1 };
static Py_ssize_t __Pyx_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };

/* ListCompAppend.proto */
#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_Check(obj)  (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* BufferFallbackError.proto */
static void __Pyx_RaiseBufferFallbackError(void);

/* None.proto */
static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);

/* BufferIndexError.proto */
static void __Pyx_RaiseBufferIndexError(int axis);

#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
/* PySequenceContains.proto */
static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
    int result = PySequence_Contains(seq, item);
    return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
}

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* RaiseNoneIterError.proto */
static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);

/* GetTopmostException.proto */
#if CYTHON_USE_EXC_INFO_STACK
static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
#endif

/* SaveResetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* PyErrExceptionMatches.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
#else
#define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
#endif

/* GetException.proto */
#if CYTHON_FAST_THREAD_STATE
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* PyObject_GenericGetAttrNoDict.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
#endif

/* PyObject_GenericGetAttr.proto */
#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
#else
#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
#endif

/* SetupReduce.proto */
static int __Pyx_setup_reduce(PyObject* type_obj);

/* TypeImport.proto */
#ifndef __PYX_HAVE_RT_ImportType_proto
#define __PYX_HAVE_RT_ImportType_proto
enum __Pyx_ImportType_CheckSize {
   __Pyx_ImportType_CheckSize_Error = 0,
   __Pyx_ImportType_CheckSize_Warn = 1,
   __Pyx_ImportType_CheckSize_Ignore = 2
};
static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
#endif

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* CLineInTraceback.proto */
#ifdef CYTHON_CLINE_IN_TRACEBACK
#define __Pyx_CLineForTraceback(tstate, c_line)  (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
#else
static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
#endif

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* BufferStructDeclare.proto */
typedef struct {
  Py_ssize_t shape, strides, suboffsets;
} __Pyx_Buf_DimInfo;
typedef struct {
  size_t refcount;
  Py_buffer pybuffer;
} __Pyx_Buffer;
typedef struct {
  __Pyx_Buffer *rcbuffer;
  char *data;
  __Pyx_Buf_DimInfo diminfo[8];
} __Pyx_LocalBuf_ND;

#if PY_MAJOR_VERSION < 3
    static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
    static void __Pyx_ReleaseBuffer(Py_buffer *view);
#else
    #define __Pyx_GetBuffer PyObject_GetBuffer
    #define __Pyx_ReleaseBuffer PyBuffer_Release
#endif


/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_siz(siz value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);

/* RealImag.proto */
#if CYTHON_CCOMPLEX
  #ifdef __cplusplus
    #define __Pyx_CREAL(z) ((z).real())
    #define __Pyx_CIMAG(z) ((z).imag())
  #else
    #define __Pyx_CREAL(z) (__real__(z))
    #define __Pyx_CIMAG(z) (__imag__(z))
  #endif
#else
    #define __Pyx_CREAL(z) ((z).real)
    #define __Pyx_CIMAG(z) ((z).imag)
#endif
#if defined(__cplusplus) && CYTHON_CCOMPLEX\
        && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
    #define __Pyx_SET_CREAL(z,x) ((z).real(x))
    #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
#else
    #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
    #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_float(a, b)   ((a)==(b))
    #define __Pyx_c_sum_float(a, b)  ((a)+(b))
    #define __Pyx_c_diff_float(a, b) ((a)-(b))
    #define __Pyx_c_prod_float(a, b) ((a)*(b))
    #define __Pyx_c_quot_float(a, b) ((a)/(b))
    #define __Pyx_c_neg_float(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
    #define __Pyx_c_conj_float(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (::std::abs(z))
        #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_float(z) ((z)==0)
    #define __Pyx_c_conj_float(z)    (conjf(z))
    #if 1
        #define __Pyx_c_abs_float(z)     (cabsf(z))
        #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
    static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
    #if 1
        static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
        static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
    #endif
#endif

/* Arithmetic.proto */
#if CYTHON_CCOMPLEX
    #define __Pyx_c_eq_double(a, b)   ((a)==(b))
    #define __Pyx_c_sum_double(a, b)  ((a)+(b))
    #define __Pyx_c_diff_double(a, b) ((a)-(b))
    #define __Pyx_c_prod_double(a, b) ((a)*(b))
    #define __Pyx_c_quot_double(a, b) ((a)/(b))
    #define __Pyx_c_neg_double(a)     (-(a))
  #ifdef __cplusplus
    #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
    #define __Pyx_c_conj_double(z)    (::std::conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (::std::abs(z))
        #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
    #endif
  #else
    #define __Pyx_c_is_zero_double(z) ((z)==0)
    #define __Pyx_c_conj_double(z)    (conj(z))
    #if 1
        #define __Pyx_c_abs_double(z)     (cabs(z))
        #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
    #endif
 #endif
#else
    static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
    static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
    static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
    #if 1
        static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
        static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
    #endif
#endif

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);

/* CIntFromPy.proto */
static CYTHON_INLINE siz __Pyx_PyInt_As_siz(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* FastTypeChecks.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
#else
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
#define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
#endif
#define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


/* Module declarations from 'cpython.buffer' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdio' */

/* Module declarations from '__builtin__' */

/* Module declarations from 'cpython.type' */
static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;

/* Module declarations from 'cpython' */

/* Module declarations from 'cpython.object' */

/* Module declarations from 'cpython.ref' */

/* Module declarations from 'cpython.mem' */

/* Module declarations from 'numpy' */

/* Module declarations from 'numpy' */
static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'pysobatools._mask' */
static PyTypeObject *__pyx_ptype_11pysobatools_5_mask_RLEs = 0;
static PyTypeObject *__pyx_ptype_11pysobatools_5_mask_Masks = 0;
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint8_t), 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_double_t = { "double_t", NULL, sizeof(__pyx_t_5numpy_double_t), { 0 }, 0, 'R', 0, 0 };
static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t = { "uint32_t", NULL, sizeof(__pyx_t_5numpy_uint32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint32_t), 0 };
#define __Pyx_MODULE_NAME "pysobatools._mask"
extern int __pyx_module_is_main_pysobatools___mask;
int __pyx_module_is_main_pysobatools___mask = 0;

/* Implementation of 'pysobatools._mask' */
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_TypeError;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_ValueError;
static PyObject *__pyx_builtin_RuntimeError;
static PyObject *__pyx_builtin_ImportError;
static const char __pyx_k_F[] = "F";
static const char __pyx_k_N[] = "N";
static const char __pyx_k_R[] = "R";
static const char __pyx_k_a[] = "_a";
static const char __pyx_k_h[] = "h";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_j[] = "j";
static const char __pyx_k_m[] = "m";
static const char __pyx_k_n[] = "n";
static const char __pyx_k_p[] = "p";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_Rs[] = "Rs";
static const char __pyx_k_bb[] = "bb";
static const char __pyx_k_dt[] = "dt";
static const char __pyx_k_gt[] = "gt";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_a_2[] = "a";
static const char __pyx_k_all[] = "all";
static const char __pyx_k_iou[] = "_iou";
static const char __pyx_k_len[] = "_len";
static const char __pyx_k_obj[] = "obj";
static const char __pyx_k_sys[] = "sys";
static const char __pyx_k_RLEs[] = "RLEs";
static const char __pyx_k_area[] = "area";
static const char __pyx_k_bb_2[] = "_bb";
static const char __pyx_k_cnts[] = "cnts";
static const char __pyx_k_data[] = "data";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_mask[] = "mask";
static const char __pyx_k_name[] = "__name__";
static const char __pyx_k_objs[] = "objs";
static const char __pyx_k_poly[] = "poly";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_utf8[] = "utf8";
static const char __pyx_k_Masks[] = "Masks";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_bbIou[] = "_bbIou";
static const char __pyx_k_dtype[] = "dtype";
static const char __pyx_k_iou_2[] = "iou";
static const char __pyx_k_isbox[] = "isbox";
static const char __pyx_k_isrle[] = "isrle";
static const char __pyx_k_masks[] = "masks";
static const char __pyx_k_merge[] = "merge";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_order[] = "order";
static const char __pyx_k_pyobj[] = "pyobj";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_uint8[] = "uint8";
static const char __pyx_k_zeros[] = "zeros";
static const char __pyx_k_astype[] = "astype";
static const char __pyx_k_author[] = "__author__";
static const char __pyx_k_counts[] = "counts";
static const char __pyx_k_decode[] = "decode";
static const char __pyx_k_double[] = "double";
static const char __pyx_k_encode[] = "encode";
static const char __pyx_k_frBbox[] = "frBbox";
static const char __pyx_k_frPoly[] = "frPoly";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_iouFun[] = "_iouFun";
static const char __pyx_k_reduce[] = "__reduce__";
static const char __pyx_k_rleIou[] = "_rleIou";
static const char __pyx_k_toBbox[] = "toBbox";
static const char __pyx_k_ucRles[] = "ucRles";
static const char __pyx_k_uint32[] = "uint32";
static const char __pyx_k_iscrowd[] = "iscrowd";
static const char __pyx_k_np_poly[] = "np_poly";
static const char __pyx_k_preproc[] = "_preproc";
static const char __pyx_k_reshape[] = "reshape";
static const char __pyx_k_rleObjs[] = "rleObjs";
static const char __pyx_k_tsungyi[] = "tsungyi";
static const char __pyx_k_c_string[] = "c_string";
static const char __pyx_k_frString[] = "_frString";
static const char __pyx_k_getstate[] = "__getstate__";
static const char __pyx_k_setstate[] = "__setstate__";
static const char __pyx_k_toString[] = "_toString";
static const char __pyx_k_TypeError[] = "TypeError";
static const char __pyx_k_enumerate[] = "enumerate";
static const char __pyx_k_intersect[] = "intersect";
static const char __pyx_k_py_string[] = "py_string";
static const char __pyx_k_pyiscrowd[] = "pyiscrowd";
static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
static const char __pyx_k_ValueError[] = "ValueError";
static const char __pyx_k_ImportError[] = "ImportError";
static const char __pyx_k_frPyObjects[] = "frPyObjects";
static const char __pyx_k_RuntimeError[] = "RuntimeError";
static const char __pyx_k_version_info[] = "version_info";
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
static const char __pyx_k_AttributeError[] = "AttributeError";
static const char __pyx_k_PYTHON_VERSION[] = "PYTHON_VERSION";
static const char __pyx_k_iou_locals__len[] = "iou.<locals>._len";
static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
static const char __pyx_k_frUncompressedRLE[] = "frUncompressedRLE";
static const char __pyx_k_iou_locals__bbIou[] = "iou.<locals>._bbIou";
static const char __pyx_k_pysobatools__mask[] = "pysobatools._mask";
static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
static const char __pyx_k_iou_locals__rleIou[] = "iou.<locals>._rleIou";
static const char __pyx_k_iou_locals__preproc[] = "iou.<locals>._preproc";
static const char __pyx_k_pysobatools__mask_pyx[] = "pysobatools/_mask.pyx";
static const char __pyx_k_input_data_type_not_allowed[] = "input data type not allowed.";
static const char __pyx_k_input_type_is_not_supported[] = "input type is not supported.";
static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
static const char __pyx_k_Python_version_must_be_2_or_3[] = "Python version must be 2 or 3";
static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
static const char __pyx_k_numpy_ndarray_input_is_only_for[] = "numpy ndarray input is only for *bounding boxes* and should have Nx4 dimension";
static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
static const char __pyx_k_unrecognized_type_The_following[] = "unrecognized type.  The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.";
static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
static const char __pyx_k_The_dt_and_gt_should_have_the_sa[] = "The dt and gt should have the same data type, either RLEs, list or np.ndarray";
static const char __pyx_k_list_input_can_be_bounding_box_N[] = "list input can be bounding box (Nx4) or RLEs ([RLE])";
static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_F;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_Masks;
static PyObject *__pyx_n_s_N;
static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
static PyObject *__pyx_n_s_PYTHON_VERSION;
static PyObject *__pyx_kp_s_Python_version_must_be_2_or_3;
static PyObject *__pyx_n_s_R;
static PyObject *__pyx_n_s_RLEs;
static PyObject *__pyx_n_s_Rs;
static PyObject *__pyx_n_s_RuntimeError;
static PyObject *__pyx_kp_s_The_dt_and_gt_should_have_the_sa;
static PyObject *__pyx_n_s_TypeError;
static PyObject *__pyx_n_s_ValueError;
static PyObject *__pyx_n_s_a;
static PyObject *__pyx_n_s_a_2;
static PyObject *__pyx_n_s_all;
static PyObject *__pyx_n_s_area;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_astype;
static PyObject *__pyx_n_s_author;
static PyObject *__pyx_n_s_bb;
static PyObject *__pyx_n_s_bbIou;
static PyObject *__pyx_n_s_bb_2;
static PyObject *__pyx_n_s_c_string;
static PyObject *__pyx_n_s_cline_in_traceback;
static PyObject *__pyx_n_s_cnts;
static PyObject *__pyx_n_s_counts;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_double;
static PyObject *__pyx_n_s_dt;
static PyObject *__pyx_n_s_dtype;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_frBbox;
static PyObject *__pyx_n_s_frPoly;
static PyObject *__pyx_n_s_frPyObjects;
static PyObject *__pyx_n_s_frString;
static PyObject *__pyx_n_s_frUncompressedRLE;
static PyObject *__pyx_n_s_getstate;
static PyObject *__pyx_n_s_gt;
static PyObject *__pyx_n_s_h;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_kp_s_input_data_type_not_allowed;
static PyObject *__pyx_kp_s_input_type_is_not_supported;
static PyObject *__pyx_n_s_intersect;
static PyObject *__pyx_n_s_iou;
static PyObject *__pyx_n_s_iouFun;
static PyObject *__pyx_n_s_iou_2;
static PyObject *__pyx_n_s_iou_locals__bbIou;
static PyObject *__pyx_n_s_iou_locals__len;
static PyObject *__pyx_n_s_iou_locals__preproc;
static PyObject *__pyx_n_s_iou_locals__rleIou;
static PyObject *__pyx_n_s_isbox;
static PyObject *__pyx_n_s_iscrowd;
static PyObject *__pyx_n_s_isrle;
static PyObject *__pyx_n_s_j;
static PyObject *__pyx_n_s_len;
static PyObject *__pyx_kp_s_list_input_can_be_bounding_box_N;
static PyObject *__pyx_n_s_m;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_mask;
static PyObject *__pyx_n_s_masks;
static PyObject *__pyx_n_s_merge;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_np_poly;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
static PyObject *__pyx_kp_s_numpy_ndarray_input_is_only_for;
static PyObject *__pyx_n_s_obj;
static PyObject *__pyx_n_s_objs;
static PyObject *__pyx_n_s_order;
static PyObject *__pyx_n_s_p;
static PyObject *__pyx_n_s_poly;
static PyObject *__pyx_n_s_preproc;
static PyObject *__pyx_n_s_py_string;
static PyObject *__pyx_n_s_pysobatools__mask;
static PyObject *__pyx_kp_s_pysobatools__mask_pyx;
static PyObject *__pyx_n_s_pyiscrowd;
static PyObject *__pyx_n_s_pyobj;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_reduce;
static PyObject *__pyx_n_s_reduce_cython;
static PyObject *__pyx_n_s_reduce_ex;
static PyObject *__pyx_n_s_reshape;
static PyObject *__pyx_n_s_rleIou;
static PyObject *__pyx_n_s_rleObjs;
static PyObject *__pyx_n_s_setstate;
static PyObject *__pyx_n_s_setstate_cython;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_toBbox;
static PyObject *__pyx_n_s_toString;
static PyObject *__pyx_n_s_tsungyi;
static PyObject *__pyx_n_s_ucRles;
static PyObject *__pyx_n_s_uint32;
static PyObject *__pyx_n_s_uint8;
static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
static PyObject *__pyx_kp_s_unrecognized_type_The_following;
static PyObject *__pyx_n_s_utf8;
static PyObject *__pyx_n_s_version_info;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_zeros;
static int __pyx_pf_11pysobatools_5_mask_4RLEs___cinit__(struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_self, siz __pyx_v_n); /* proto */
static void __pyx_pf_11pysobatools_5_mask_4RLEs_2__dealloc__(struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_4RLEs_4__getattr__(struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_4RLEs_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_4RLEs_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static int __pyx_pf_11pysobatools_5_mask_5Masks___cinit__(struct __pyx_obj_11pysobatools_5_mask_Masks *__pyx_v_self, PyObject *__pyx_v_h, PyObject *__pyx_v_w, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_5Masks_2__array__(struct __pyx_obj_11pysobatools_5_mask_Masks *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_5Masks_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11pysobatools_5_mask_Masks *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_5Masks_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11pysobatools_5_mask_Masks *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask__toString(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_Rs); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_2_frString(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_4encode(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mask); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_6decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_8merge(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs, PyObject *__pyx_v_intersect); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_10area(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_3iou__preproc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_objs); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_3iou_2_rleIou(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_dt, struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_gt, PyArrayObject *__pyx_v_iscrowd, siz __pyx_v_m, siz __pyx_v_n, PyArrayObject *__pyx_v__iou); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_3iou_4_bbIou(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dt, PyArrayObject *__pyx_v_gt, PyArrayObject *__pyx_v_iscrowd, siz __pyx_v_m, siz __pyx_v_n, PyArrayObject *__pyx_v__iou); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_3iou_6_len(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_12iou(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dt, PyObject *__pyx_v_gt, PyObject *__pyx_v_pyiscrowd); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_14toBbox(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_16frBbox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_bb, siz __pyx_v_h, siz __pyx_v_w); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_18frPoly(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_poly, siz __pyx_v_h, siz __pyx_v_w); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_20frUncompressedRLE(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ucRles, CYTHON_UNUSED siz __pyx_v_h, CYTHON_UNUSED siz __pyx_v_w); /* proto */
static PyObject *__pyx_pf_11pysobatools_5_mask_22frPyObjects(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pyobj, PyObject *__pyx_v_h, PyObject *__pyx_v_w); /* proto */
static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
static PyObject *__pyx_tp_new_11pysobatools_5_mask_RLEs(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_11pysobatools_5_mask_Masks(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_4;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__5;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__7;
static PyObject *__pyx_tuple__8;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__14;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__42;
static PyObject *__pyx_tuple__44;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__48;
static PyObject *__pyx_tuple__50;
static PyObject *__pyx_codeobj__11;
static PyObject *__pyx_codeobj__13;
static PyObject *__pyx_codeobj__15;
static PyObject *__pyx_codeobj__17;
static PyObject *__pyx_codeobj__29;
static PyObject *__pyx_codeobj__31;
static PyObject *__pyx_codeobj__33;
static PyObject *__pyx_codeobj__35;
static PyObject *__pyx_codeobj__37;
static PyObject *__pyx_codeobj__39;
static PyObject *__pyx_codeobj__41;
static PyObject *__pyx_codeobj__43;
static PyObject *__pyx_codeobj__45;
static PyObject *__pyx_codeobj__47;
static PyObject *__pyx_codeobj__49;
static PyObject *__pyx_codeobj__51;
/* Late includes */

/* "pysobatools/_mask.pyx":60
 *     cdef siz _n
 * 
 *     def __cinit__(self, siz n =0):             # <<<<<<<<<<<<<<
 *         rlesInit(&self._R, n)
 *         self._n = n
 */

/* Python wrapper */
static int __pyx_pw_11pysobatools_5_mask_4RLEs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_11pysobatools_5_mask_4RLEs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  siz __pyx_v_n;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
    PyObject* values[1] = {0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 60, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    if (values[0]) {
      __pyx_v_n = __Pyx_PyInt_As_siz(values[0]); if (unlikely((__pyx_v_n == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error)
    } else {
      __pyx_v_n = ((siz)0);
    }
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysobatools._mask.RLEs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11pysobatools_5_mask_4RLEs___cinit__(((struct __pyx_obj_11pysobatools_5_mask_RLEs *)__pyx_v_self), __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11pysobatools_5_mask_4RLEs___cinit__(struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_self, siz __pyx_v_n) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pysobatools/_mask.pyx":61
 * 
 *     def __cinit__(self, siz n =0):
 *         rlesInit(&self._R, n)             # <<<<<<<<<<<<<<
 *         self._n = n
 * 
 */
  rlesInit((&__pyx_v_self->_R), __pyx_v_n);

  /* "pysobatools/_mask.pyx":62
 *     def __cinit__(self, siz n =0):
 *         rlesInit(&self._R, n)
 *         self._n = n             # <<<<<<<<<<<<<<
 * 
 *     # free the RLE array here
 */
  __pyx_v_self->_n = __pyx_v_n;

  /* "pysobatools/_mask.pyx":60
 *     cdef siz _n
 * 
 *     def __cinit__(self, siz n =0):             # <<<<<<<<<<<<<<
 *         rlesInit(&self._R, n)
 *         self._n = n
 */

  /* function exit code */
  __pyx_r = 0;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysobatools/_mask.pyx":65
 * 
 *     # free the RLE array here
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._R is not NULL:
 *             for i in range(self._n):
 */

/* Python wrapper */
static void __pyx_pw_11pysobatools_5_mask_4RLEs_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_11pysobatools_5_mask_4RLEs_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_11pysobatools_5_mask_4RLEs_2__dealloc__(((struct __pyx_obj_11pysobatools_5_mask_RLEs *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_11pysobatools_5_mask_4RLEs_2__dealloc__(struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_self) {
  siz __pyx_v_i;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  siz __pyx_t_2;
  siz __pyx_t_3;
  siz __pyx_t_4;
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "pysobatools/_mask.pyx":66
 *     # free the RLE array here
 *     def __dealloc__(self):
 *         if self._R is not NULL:             # <<<<<<<<<<<<<<
 *             for i in range(self._n):
 *                 free(self._R[i].cnts)
 */
  __pyx_t_1 = ((__pyx_v_self->_R != NULL) != 0);
  if (__pyx_t_1) {

    /* "pysobatools/_mask.pyx":67
 *     def __dealloc__(self):
 *         if self._R is not NULL:
 *             for i in range(self._n):             # <<<<<<<<<<<<<<
 *                 free(self._R[i].cnts)
 *             free(self._R)
 */
    __pyx_t_2 = __pyx_v_self->_n;
    __pyx_t_3 = __pyx_t_2;
    for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
      __pyx_v_i = __pyx_t_4;

      /* "pysobatools/_mask.pyx":68
 *         if self._R is not NULL:
 *             for i in range(self._n):
 *                 free(self._R[i].cnts)             # <<<<<<<<<<<<<<
 *             free(self._R)
 *     def __getattr__(self, key):
 */
      free((__pyx_v_self->_R[__pyx_v_i]).cnts);
    }

    /* "pysobatools/_mask.pyx":69
 *             for i in range(self._n):
 *                 free(self._R[i].cnts)
 *             free(self._R)             # <<<<<<<<<<<<<<
 *     def __getattr__(self, key):
 *         if key == 'n':
 */
    free(__pyx_v_self->_R);

    /* "pysobatools/_mask.pyx":66
 *     # free the RLE array here
 *     def __dealloc__(self):
 *         if self._R is not NULL:             # <<<<<<<<<<<<<<
 *             for i in range(self._n):
 *                 free(self._R[i].cnts)
 */
  }

  /* "pysobatools/_mask.pyx":65
 * 
 *     # free the RLE array here
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         if self._R is not NULL:
 *             for i in range(self._n):
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "pysobatools/_mask.pyx":70
 *                 free(self._R[i].cnts)
 *             free(self._R)
 *     def __getattr__(self, key):             # <<<<<<<<<<<<<<
 *         if key == 'n':
 *             return self._n
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_4RLEs_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
static PyObject *__pyx_pw_11pysobatools_5_mask_4RLEs_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11pysobatools_5_mask_4RLEs_4__getattr__(((struct __pyx_obj_11pysobatools_5_mask_RLEs *)__pyx_v_self), ((PyObject *)__pyx_v_key));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11pysobatools_5_mask_4RLEs_4__getattr__(struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_self, PyObject *__pyx_v_key) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  __Pyx_RefNannySetupContext("__getattr__", 0);

  /* "pysobatools/_mask.pyx":71
 *             free(self._R)
 *     def __getattr__(self, key):
 *         if key == 'n':             # <<<<<<<<<<<<<<
 *             return self._n
 *         raise AttributeError(key)
 */
  __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_n, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 71, __pyx_L1_error)
  if (__pyx_t_1) {

    /* "pysobatools/_mask.pyx":72
 *     def __getattr__(self, key):
 *         if key == 'n':
 *             return self._n             # <<<<<<<<<<<<<<
 *         raise AttributeError(key)
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_2 = __Pyx_PyInt_From_siz(__pyx_v_self->_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;

    /* "pysobatools/_mask.pyx":71
 *             free(self._R)
 *     def __getattr__(self, key):
 *         if key == 'n':             # <<<<<<<<<<<<<<
 *             return self._n
 *         raise AttributeError(key)
 */
  }

  /* "pysobatools/_mask.pyx":73
 *         if key == 'n':
 *             return self._n
 *         raise AttributeError(key)             # <<<<<<<<<<<<<<
 * 
 * # python class to wrap Mask array in C
 */
  __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_v_key); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_Raise(__pyx_t_2, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __PYX_ERR(0, 73, __pyx_L1_error)

  /* "pysobatools/_mask.pyx":70
 *                 free(self._R[i].cnts)
 *             free(self._R)
 *     def __getattr__(self, key):             # <<<<<<<<<<<<<<
 *         if key == 'n':
 *             return self._n
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("pysobatools._mask.RLEs.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_4RLEs_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11pysobatools_5_mask_4RLEs_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11pysobatools_5_mask_4RLEs_6__reduce_cython__(((struct __pyx_obj_11pysobatools_5_mask_RLEs *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11pysobatools_5_mask_4RLEs_6__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysobatools._mask.RLEs.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_4RLEs_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11pysobatools_5_mask_4RLEs_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11pysobatools_5_mask_4RLEs_8__setstate_cython__(((struct __pyx_obj_11pysobatools_5_mask_RLEs *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11pysobatools_5_mask_4RLEs_8__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysobatools._mask.RLEs.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysobatools/_mask.pyx":83
 *     cdef siz _n
 * 
 *     def __cinit__(self, h, w, n):             # <<<<<<<<<<<<<<
 *         self._mask = <byte*> malloc(h*w*n* sizeof(byte))
 *         self._h = h
 */

/* Python wrapper */
static int __pyx_pw_11pysobatools_5_mask_5Masks_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_11pysobatools_5_mask_5Masks_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_h = 0;
  PyObject *__pyx_v_w = 0;
  PyObject *__pyx_v_n = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_h,&__pyx_n_s_w,&__pyx_n_s_n,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        CYTHON_FALLTHROUGH;
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 83, __pyx_L3_error)
        }
        CYTHON_FALLTHROUGH;
        case  2:
        if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 83, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 83, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_h = values[0];
    __pyx_v_w = values[1];
    __pyx_v_n = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 83, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysobatools._mask.Masks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_11pysobatools_5_mask_5Masks___cinit__(((struct __pyx_obj_11pysobatools_5_mask_Masks *)__pyx_v_self), __pyx_v_h, __pyx_v_w, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_11pysobatools_5_mask_5Masks___cinit__(struct __pyx_obj_11pysobatools_5_mask_Masks *__pyx_v_self, PyObject *__pyx_v_h, PyObject *__pyx_v_w, PyObject *__pyx_v_n) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  size_t __pyx_t_4;
  siz __pyx_t_5;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "pysobatools/_mask.pyx":84
 * 
 *     def __cinit__(self, h, w, n):
 *         self._mask = <byte*> malloc(h*w*n* sizeof(byte))             # <<<<<<<<<<<<<<
 *         self._h = h
 *         self._w = w
 */
  __pyx_t_1 = PyNumber_Multiply(__pyx_v_h, __pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(byte))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_self->_mask = ((byte *)malloc(__pyx_t_4));

  /* "pysobatools/_mask.pyx":85
 *     def __cinit__(self, h, w, n):
 *         self._mask = <byte*> malloc(h*w*n* sizeof(byte))
 *         self._h = h             # <<<<<<<<<<<<<<
 *         self._w = w
 *         self._n = n
 */
  __pyx_t_5 = __Pyx_PyInt_As_siz(__pyx_v_h); if (unlikely((__pyx_t_5 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
  __pyx_v_self->_h = __pyx_t_5;

  /* "pysobatools/_mask.pyx":86
 *         self._mask = <byte*> malloc(h*w*n* sizeof(byte))
 *         self._h = h
 *         self._w = w             # <<<<<<<<<<<<<<
 *         self._n = n
 *     # def __dealloc__(self):
 */
  __pyx_t_5 = __Pyx_PyInt_As_siz(__pyx_v_w); if (unlikely((__pyx_t_5 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error)
  __pyx_v_self->_w = __pyx_t_5;

  /* "pysobatools/_mask.pyx":87
 *         self._h = h
 *         self._w = w
 *         self._n = n             # <<<<<<<<<<<<<<
 *     # def __dealloc__(self):
 *         # the memory management of _mask has been passed to np.ndarray
 */
  __pyx_t_5 = __Pyx_PyInt_As_siz(__pyx_v_n); if (unlikely((__pyx_t_5 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error)
  __pyx_v_self->_n = __pyx_t_5;

  /* "pysobatools/_mask.pyx":83
 *     cdef siz _n
 * 
 *     def __cinit__(self, h, w, n):             # <<<<<<<<<<<<<<
 *         self._mask = <byte*> malloc(h*w*n* sizeof(byte))
 *         self._h = h
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("pysobatools._mask.Masks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysobatools/_mask.pyx":93
 * 
 *     # called when passing into np.array() and return an np.ndarray in column-major order
 *     def __array__(self):             # <<<<<<<<<<<<<<
 *         cdef np.npy_intp shape[1]
 *         shape[0] = <np.npy_intp> self._h*self._w*self._n
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_5Masks_3__array__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11pysobatools_5_mask_5Masks_3__array__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__array__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11pysobatools_5_mask_5Masks_2__array__(((struct __pyx_obj_11pysobatools_5_mask_Masks *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11pysobatools_5_mask_5Masks_2__array__(struct __pyx_obj_11pysobatools_5_mask_Masks *__pyx_v_self) {
  npy_intp __pyx_v_shape[1];
  PyObject *__pyx_v_ndarray = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  __Pyx_RefNannySetupContext("__array__", 0);

  /* "pysobatools/_mask.pyx":95
 *     def __array__(self):
 *         cdef np.npy_intp shape[1]
 *         shape[0] = <np.npy_intp> self._h*self._w*self._n             # <<<<<<<<<<<<<<
 *         # Create a 1D array, and reshape it to fortran/Matlab column-major array
 *         ndarray = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT8, self._mask).reshape((self._h, self._w, self._n), order='F')
 */
  (__pyx_v_shape[0]) = ((((npy_intp)__pyx_v_self->_h) * __pyx_v_self->_w) * __pyx_v_self->_n);

  /* "pysobatools/_mask.pyx":97
 *         shape[0] = <np.npy_intp> self._h*self._w*self._n
 *         # Create a 1D array, and reshape it to fortran/Matlab column-major array
 *         ndarray = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT8, self._mask).reshape((self._h, self._w, self._n), order='F')             # <<<<<<<<<<<<<<
 *         # The _mask allocated by Masks is now handled by ndarray
 *         PyArray_ENABLEFLAGS(ndarray, np.NPY_OWNDATA)
 */
  __pyx_t_1 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_UINT8, __pyx_v_self->_mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyInt_From_siz(__pyx_v_self->_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_From_siz(__pyx_v_self->_w); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyInt_From_siz(__pyx_v_self->_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
  __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_order, __pyx_n_s_F) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_ndarray = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "pysobatools/_mask.pyx":99
 *         ndarray = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT8, self._mask).reshape((self._h, self._w, self._n), order='F')
 *         # The _mask allocated by Masks is now handled by ndarray
 *         PyArray_ENABLEFLAGS(ndarray, np.NPY_OWNDATA)             # <<<<<<<<<<<<<<
 *         return ndarray
 * 
 */
  if (!(likely(((__pyx_v_ndarray) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_ndarray, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 99, __pyx_L1_error)
  PyArray_ENABLEFLAGS(((PyArrayObject *)__pyx_v_ndarray), NPY_OWNDATA);

  /* "pysobatools/_mask.pyx":100
 *         # The _mask allocated by Masks is now handled by ndarray
 *         PyArray_ENABLEFLAGS(ndarray, np.NPY_OWNDATA)
 *         return ndarray             # <<<<<<<<<<<<<<
 * 
 * # internal conversion from Python RLEs object to compressed RLE format
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_ndarray);
  __pyx_r = __pyx_v_ndarray;
  goto __pyx_L0;

  /* "pysobatools/_mask.pyx":93
 * 
 *     # called when passing into np.array() and return an np.ndarray in column-major order
 *     def __array__(self):             # <<<<<<<<<<<<<<
 *         cdef np.npy_intp shape[1]
 *         shape[0] = <np.npy_intp> self._h*self._w*self._n
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("pysobatools._mask.Masks.__array__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ndarray);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_5Masks_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_11pysobatools_5_mask_5Masks_5__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11pysobatools_5_mask_5Masks_4__reduce_cython__(((struct __pyx_obj_11pysobatools_5_mask_Masks *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11pysobatools_5_mask_5Masks_4__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_11pysobatools_5_mask_Masks *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__reduce_cython__", 0);

  /* "(tree fragment)":2
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 2, __pyx_L1_error)

  /* "(tree fragment)":1
 * def __reduce_cython__(self):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysobatools._mask.Masks.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_5Masks_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
static PyObject *__pyx_pw_11pysobatools_5_mask_5Masks_7__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
  __pyx_r = __pyx_pf_11pysobatools_5_mask_5Masks_6__setstate_cython__(((struct __pyx_obj_11pysobatools_5_mask_Masks *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11pysobatools_5_mask_5Masks_6__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_11pysobatools_5_mask_Masks *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  __Pyx_RefNannySetupContext("__setstate_cython__", 0);

  /* "(tree fragment)":4
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")             # <<<<<<<<<<<<<<
 */
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_Raise(__pyx_t_1, 0, 0, 0);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __PYX_ERR(1, 4, __pyx_L1_error)

  /* "(tree fragment)":3
 * def __reduce_cython__(self):
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 * def __setstate_cython__(self, __pyx_state):             # <<<<<<<<<<<<<<
 *     raise TypeError("no default __reduce__ due to non-trivial __cinit__")
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("pysobatools._mask.Masks.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysobatools/_mask.pyx":103
 * 
 * # internal conversion from Python RLEs object to compressed RLE format
 * def _toString(RLEs Rs):             # <<<<<<<<<<<<<<
 *     cdef siz n = Rs.n
 *     cdef bytes py_string
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_1_toString(PyObject *__pyx_self, PyObject *__pyx_v_Rs); /*proto*/
static PyMethodDef __pyx_mdef_11pysobatools_5_mask_1_toString = {"_toString", (PyCFunction)__pyx_pw_11pysobatools_5_mask_1_toString, METH_O, 0};
static PyObject *__pyx_pw_11pysobatools_5_mask_1_toString(PyObject *__pyx_self, PyObject *__pyx_v_Rs) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_toString (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Rs), __pyx_ptype_11pysobatools_5_mask_RLEs, 1, "Rs", 0))) __PYX_ERR(0, 103, __pyx_L1_error)
  __pyx_r = __pyx_pf_11pysobatools_5_mask__toString(__pyx_self, ((struct __pyx_obj_11pysobatools_5_mask_RLEs *)__pyx_v_Rs));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11pysobatools_5_mask__toString(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_Rs) {
  siz __pyx_v_n;
  PyObject *__pyx_v_py_string = 0;
  char *__pyx_v_c_string;
  PyObject *__pyx_v_objs = NULL;
  siz __pyx_v_i;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  siz __pyx_t_2;
  siz __pyx_t_3;
  siz __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("_toString", 0);

  /* "pysobatools/_mask.pyx":104
 * # internal conversion from Python RLEs object to compressed RLE format
 * def _toString(RLEs Rs):
 *     cdef siz n = Rs.n             # <<<<<<<<<<<<<<
 *     cdef bytes py_string
 *     cdef char* c_string
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Rs), __pyx_n_s_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_As_siz(__pyx_t_1); if (unlikely((__pyx_t_2 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_n = __pyx_t_2;

  /* "pysobatools/_mask.pyx":107
 *     cdef bytes py_string
 *     cdef char* c_string
 *     objs = []             # <<<<<<<<<<<<<<
 *     for i in range(n):
 *         c_string = rleToString( <RLE*> &Rs._R[i] )
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_objs = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysobatools/_mask.pyx":108
 *     cdef char* c_string
 *     objs = []
 *     for i in range(n):             # <<<<<<<<<<<<<<
 *         c_string = rleToString( <RLE*> &Rs._R[i] )
 *         py_string = c_string
 */
  __pyx_t_2 = __pyx_v_n;
  __pyx_t_3 = __pyx_t_2;
  for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
    __pyx_v_i = __pyx_t_4;

    /* "pysobatools/_mask.pyx":109
 *     objs = []
 *     for i in range(n):
 *         c_string = rleToString( <RLE*> &Rs._R[i] )             # <<<<<<<<<<<<<<
 *         py_string = c_string
 *         objs.append({
 */
    __pyx_v_c_string = rleToString(((RLE *)(&(__pyx_v_Rs->_R[__pyx_v_i]))));

    /* "pysobatools/_mask.pyx":110
 *     for i in range(n):
 *         c_string = rleToString( <RLE*> &Rs._R[i] )
 *         py_string = c_string             # <<<<<<<<<<<<<<
 *         objs.append({
 *             'size': [Rs._R[i].h, Rs._R[i].w],
 */
    __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_c_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_py_string, ((PyObject*)__pyx_t_1));
    __pyx_t_1 = 0;

    /* "pysobatools/_mask.pyx":112
 *         py_string = c_string
 *         objs.append({
 *             'size': [Rs._R[i].h, Rs._R[i].w],             # <<<<<<<<<<<<<<
 *             'counts': py_string
 *         })
 */
    __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_5 = __Pyx_PyInt_From_siz((__pyx_v_Rs->_R[__pyx_v_i]).h); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_siz((__pyx_v_Rs->_R[__pyx_v_i]).w); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = PyList_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_6);
    PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_size, __pyx_t_7) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "pysobatools/_mask.pyx":113
 *         objs.append({
 *             'size': [Rs._R[i].h, Rs._R[i].w],
 *             'counts': py_string             # <<<<<<<<<<<<<<
 *         })
 *         free(c_string)
 */
    if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_counts, __pyx_v_py_string) < 0) __PYX_ERR(0, 112, __pyx_L1_error)

    /* "pysobatools/_mask.pyx":111
 *         c_string = rleToString( <RLE*> &Rs._R[i] )
 *         py_string = c_string
 *         objs.append({             # <<<<<<<<<<<<<<
 *             'size': [Rs._R[i].h, Rs._R[i].w],
 *             'counts': py_string
 */
    __pyx_t_8 = __Pyx_PyList_Append(__pyx_v_objs, __pyx_t_1); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(0, 111, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "pysobatools/_mask.pyx":115
 *             'counts': py_string
 *         })
 *         free(c_string)             # <<<<<<<<<<<<<<
 *     return objs
 * 
 */
    free(__pyx_v_c_string);
  }

  /* "pysobatools/_mask.pyx":116
 *         })
 *         free(c_string)
 *     return objs             # <<<<<<<<<<<<<<
 * 
 * # internal conversion from compressed RLE format to Python RLEs object
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_objs);
  __pyx_r = __pyx_v_objs;
  goto __pyx_L0;

  /* "pysobatools/_mask.pyx":103
 * 
 * # internal conversion from Python RLEs object to compressed RLE format
 * def _toString(RLEs Rs):             # <<<<<<<<<<<<<<
 *     cdef siz n = Rs.n
 *     cdef bytes py_string
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysobatools._mask._toString", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_py_string);
  __Pyx_XDECREF(__pyx_v_objs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysobatools/_mask.pyx":119
 * 
 * # internal conversion from compressed RLE format to Python RLEs object
 * def _frString(rleObjs):             # <<<<<<<<<<<<<<
 *     cdef siz n = len(rleObjs)
 *     Rs = RLEs(n)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_3_frString(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /*proto*/
static PyMethodDef __pyx_mdef_11pysobatools_5_mask_3_frString = {"_frString", (PyCFunction)__pyx_pw_11pysobatools_5_mask_3_frString, METH_O, 0};
static PyObject *__pyx_pw_11pysobatools_5_mask_3_frString(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_frString (wrapper)", 0);
  __pyx_r = __pyx_pf_11pysobatools_5_mask_2_frString(__pyx_self, ((PyObject *)__pyx_v_rleObjs));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11pysobatools_5_mask_2_frString(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
  siz __pyx_v_n;
  struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_Rs = NULL;
  PyObject *__pyx_v_py_string = 0;
  char *__pyx_v_c_string;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_obj = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  char *__pyx_t_11;
  Py_ssize_t __pyx_t_12;
  siz __pyx_t_13;
  siz __pyx_t_14;
  __Pyx_RefNannySetupContext("_frString", 0);

  /* "pysobatools/_mask.pyx":120
 * # internal conversion from compressed RLE format to Python RLEs object
 * def _frString(rleObjs):
 *     cdef siz n = len(rleObjs)             # <<<<<<<<<<<<<<
 *     Rs = RLEs(n)
 *     cdef bytes py_string
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_rleObjs); if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(0, 120, __pyx_L1_error)
  __pyx_v_n = __pyx_t_1;

  /* "pysobatools/_mask.pyx":121
 * def _frString(rleObjs):
 *     cdef siz n = len(rleObjs)
 *     Rs = RLEs(n)             # <<<<<<<<<<<<<<
 *     cdef bytes py_string
 *     cdef char* c_string
 */
  __pyx_t_2 = __Pyx_PyInt_From_siz(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_11pysobatools_5_mask_RLEs), __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_Rs = ((struct __pyx_obj_11pysobatools_5_mask_RLEs *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysobatools/_mask.pyx":124
 *     cdef bytes py_string
 *     cdef char* c_string
 *     for i, obj in enumerate(rleObjs):             # <<<<<<<<<<<<<<
 *         if PYTHON_VERSION == 2:
 *             py_string = str(obj['counts']).encode('utf8')
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_3 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_rleObjs)) || PyTuple_CheckExact(__pyx_v_rleObjs)) {
    __pyx_t_2 = __pyx_v_rleObjs; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_rleObjs); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 124, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      } else {
        if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_5);
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_2);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 124, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_INCREF(__pyx_t_3);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3);
    __pyx_t_3 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "pysobatools/_mask.pyx":125
 *     cdef char* c_string
 *     for i, obj in enumerate(rleObjs):
 *         if PYTHON_VERSION == 2:             # <<<<<<<<<<<<<<
 *             py_string = str(obj['counts']).encode('utf8')
 *         elif PYTHON_VERSION == 3:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_PYTHON_VERSION); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 125, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__pyx_t_7) {

      /* "pysobatools/_mask.pyx":126
 *     for i, obj in enumerate(rleObjs):
 *         if PYTHON_VERSION == 2:
 *             py_string = str(obj['counts']).encode('utf8')             # <<<<<<<<<<<<<<
 *         elif PYTHON_VERSION == 3:
 *             py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
 */
      __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_counts); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_8 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_5); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_8 = NULL;
      if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_8)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_8);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      __pyx_t_6 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_8, __pyx_n_s_utf8) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_utf8);
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 126, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 126, __pyx_L1_error)
      __Pyx_XDECREF_SET(__pyx_v_py_string, ((PyObject*)__pyx_t_6));
      __pyx_t_6 = 0;

      /* "pysobatools/_mask.pyx":125
 *     cdef char* c_string
 *     for i, obj in enumerate(rleObjs):
 *         if PYTHON_VERSION == 2:             # <<<<<<<<<<<<<<
 *             py_string = str(obj['counts']).encode('utf8')
 *         elif PYTHON_VERSION == 3:
 */
      goto __pyx_L5;
    }

    /* "pysobatools/_mask.pyx":127
 *         if PYTHON_VERSION == 2:
 *             py_string = str(obj['counts']).encode('utf8')
 *         elif PYTHON_VERSION == 3:             # <<<<<<<<<<<<<<
 *             py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
 *         else:
 */
    __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_PYTHON_VERSION); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 127, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 127, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (likely(__pyx_t_7)) {

      /* "pysobatools/_mask.pyx":128
 *             py_string = str(obj['counts']).encode('utf8')
 *         elif PYTHON_VERSION == 3:
 *             py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']             # <<<<<<<<<<<<<<
 *         else:
 *             raise Exception('Python version must be 2 or 3')
 */
      __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_counts); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_8 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_6)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 128, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      if (__pyx_t_7) {
        __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyString_Type)), __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_6);
        __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_counts); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 128, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_9);
        __pyx_t_10 = NULL;
        if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
          __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
          if (likely(__pyx_t_10)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
            __Pyx_INCREF(__pyx_t_10);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_6, function);
          }
        }
        __pyx_t_8 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_10, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9);
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
        if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        if (!(likely(PyBytes_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(0, 128, __pyx_L1_error)
        __pyx_t_5 = __pyx_t_8;
        __pyx_t_8 = 0;
      } else {
        __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_counts); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_8);
        if (!(likely(PyBytes_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(0, 128, __pyx_L1_error)
        __pyx_t_5 = __pyx_t_8;
        __pyx_t_8 = 0;
      }
      __Pyx_XDECREF_SET(__pyx_v_py_string, ((PyObject*)__pyx_t_5));
      __pyx_t_5 = 0;

      /* "pysobatools/_mask.pyx":127
 *         if PYTHON_VERSION == 2:
 *             py_string = str(obj['counts']).encode('utf8')
 *         elif PYTHON_VERSION == 3:             # <<<<<<<<<<<<<<
 *             py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
 *         else:
 */
      goto __pyx_L5;
    }

    /* "pysobatools/_mask.pyx":130
 *             py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
 *         else:
 *             raise Exception('Python version must be 2 or 3')             # <<<<<<<<<<<<<<
 *         c_string = py_string
 *         rleFrString( <RLE*> &Rs._R[i], <char*> c_string, obj['size'][0], obj['size'][1] )
 */
    /*else*/ {
      __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_Raise(__pyx_t_5, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __PYX_ERR(0, 130, __pyx_L1_error)
    }
    __pyx_L5:;

    /* "pysobatools/_mask.pyx":131
 *         else:
 *             raise Exception('Python version must be 2 or 3')
 *         c_string = py_string             # <<<<<<<<<<<<<<
 *         rleFrString( <RLE*> &Rs._R[i], <char*> c_string, obj['size'][0], obj['size'][1] )
 *     return Rs
 */
    if (unlikely(__pyx_v_py_string == Py_None)) {
      PyErr_SetString(PyExc_TypeError, "expected bytes, NoneType found");
      __PYX_ERR(0, 131, __pyx_L1_error)
    }
    __pyx_t_11 = __Pyx_PyBytes_AsWritableString(__pyx_v_py_string); if (unlikely((!__pyx_t_11) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L1_error)
    __pyx_v_c_string = __pyx_t_11;

    /* "pysobatools/_mask.pyx":132
 *             raise Exception('Python version must be 2 or 3')
 *         c_string = py_string
 *         rleFrString( <RLE*> &Rs._R[i], <char*> c_string, obj['size'][0], obj['size'][1] )             # <<<<<<<<<<<<<<
 *     return Rs
 * 
 */
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
    __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_13 = __Pyx_PyInt_As_siz(__pyx_t_8); if (unlikely((__pyx_t_13 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_size); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_8, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 132, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_14 = __Pyx_PyInt_As_siz(__pyx_t_5); if (unlikely((__pyx_t_14 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    rleFrString(((RLE *)(&(__pyx_v_Rs->_R[__pyx_t_12]))), ((char *)__pyx_v_c_string), __pyx_t_13, __pyx_t_14);

    /* "pysobatools/_mask.pyx":124
 *     cdef bytes py_string
 *     cdef char* c_string
 *     for i, obj in enumerate(rleObjs):             # <<<<<<<<<<<<<<
 *         if PYTHON_VERSION == 2:
 *             py_string = str(obj['counts']).encode('utf8')
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "pysobatools/_mask.pyx":133
 *         c_string = py_string
 *         rleFrString( <RLE*> &Rs._R[i], <char*> c_string, obj['size'][0], obj['size'][1] )
 *     return Rs             # <<<<<<<<<<<<<<
 * 
 * # encode mask to RLEs objects
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_Rs));
  __pyx_r = ((PyObject *)__pyx_v_Rs);
  goto __pyx_L0;

  /* "pysobatools/_mask.pyx":119
 * 
 * # internal conversion from compressed RLE format to Python RLEs object
 * def _frString(rleObjs):             # <<<<<<<<<<<<<<
 *     cdef siz n = len(rleObjs)
 *     Rs = RLEs(n)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("pysobatools._mask._frString", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
  __Pyx_XDECREF(__pyx_v_py_string);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_obj);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysobatools/_mask.pyx":137
 * # encode mask to RLEs objects
 * # list of RLE string can be generated by RLEs member function
 * def encode(np.ndarray[np.uint8_t, ndim=3, mode='fortran'] mask):             # <<<<<<<<<<<<<<
 *     h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]
 *     cdef RLEs Rs = RLEs(n)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_5encode(PyObject *__pyx_self, PyObject *__pyx_v_mask); /*proto*/
static PyMethodDef __pyx_mdef_11pysobatools_5_mask_5encode = {"encode", (PyCFunction)__pyx_pw_11pysobatools_5_mask_5encode, METH_O, 0};
static PyObject *__pyx_pw_11pysobatools_5_mask_5encode(PyObject *__pyx_self, PyObject *__pyx_v_mask) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("encode (wrapper)", 0);
  if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) __PYX_ERR(0, 137, __pyx_L1_error)
  __pyx_r = __pyx_pf_11pysobatools_5_mask_4encode(__pyx_self, ((PyArrayObject *)__pyx_v_mask));

  /* function exit code */
  goto __pyx_L0;
  __pyx_L1_error:;
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11pysobatools_5_mask_4encode(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mask) {
  npy_intp __pyx_v_h;
  npy_intp __pyx_v_w;
  npy_intp __pyx_v_n;
  struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_Rs = 0;
  PyObject *__pyx_v_objs = NULL;
  __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
  __Pyx_Buffer __pyx_pybuffer_mask;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  npy_intp __pyx_t_1;
  npy_intp __pyx_t_2;
  npy_intp __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  __Pyx_RefNannySetupContext("encode", 0);
  __pyx_pybuffer_mask.pybuffer.buf = NULL;
  __pyx_pybuffer_mask.refcount = 0;
  __pyx_pybuffernd_mask.data = NULL;
  __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
  {
    __Pyx_BufFmt_StackElem __pyx_stack[1];
    if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_F_CONTIGUOUS, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 137, __pyx_L1_error)
  }
  __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_mask.diminfo[2].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_mask.diminfo[2].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[2];

  /* "pysobatools/_mask.pyx":138
 * # list of RLE string can be generated by RLEs member function
 * def encode(np.ndarray[np.uint8_t, ndim=3, mode='fortran'] mask):
 *     h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]             # <<<<<<<<<<<<<<
 *     cdef RLEs Rs = RLEs(n)
 *     rleEncode(Rs._R,<byte*>mask.data,h,w,n)
 */
  __pyx_t_1 = (__pyx_v_mask->dimensions[0]);
  __pyx_t_2 = (__pyx_v_mask->dimensions[1]);
  __pyx_t_3 = (__pyx_v_mask->dimensions[2]);
  __pyx_v_h = __pyx_t_1;
  __pyx_v_w = __pyx_t_2;
  __pyx_v_n = __pyx_t_3;

  /* "pysobatools/_mask.pyx":139
 * def encode(np.ndarray[np.uint8_t, ndim=3, mode='fortran'] mask):
 *     h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]
 *     cdef RLEs Rs = RLEs(n)             # <<<<<<<<<<<<<<
 *     rleEncode(Rs._R,<byte*>mask.data,h,w,n)
 *     objs = _toString(Rs)
 */
  __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_11pysobatools_5_mask_RLEs), __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_Rs = ((struct __pyx_obj_11pysobatools_5_mask_RLEs *)__pyx_t_5);
  __pyx_t_5 = 0;

  /* "pysobatools/_mask.pyx":140
 *     h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]
 *     cdef RLEs Rs = RLEs(n)
 *     rleEncode(Rs._R,<byte*>mask.data,h,w,n)             # <<<<<<<<<<<<<<
 *     objs = _toString(Rs)
 *     return objs
 */
  rleEncode(__pyx_v_Rs->_R, ((byte *)__pyx_v_mask->data), __pyx_v_h, __pyx_v_w, __pyx_v_n);

  /* "pysobatools/_mask.pyx":141
 *     cdef RLEs Rs = RLEs(n)
 *     rleEncode(Rs._R,<byte*>mask.data,h,w,n)
 *     objs = _toString(Rs)             # <<<<<<<<<<<<<<
 *     return objs
 * 
 */
  __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_toString); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  __pyx_t_5 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_6, ((PyObject *)__pyx_v_Rs)) : __Pyx_PyObject_CallOneArg(__pyx_t_4, ((PyObject *)__pyx_v_Rs));
  __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
  if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_objs = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "pysobatools/_mask.pyx":142
 *     rleEncode(Rs._R,<byte*>mask.data,h,w,n)
 *     objs = _toString(Rs)
 *     return objs             # <<<<<<<<<<<<<<
 * 
 * # decode mask from compressed list of RLE string or RLEs object
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_objs);
  __pyx_r = __pyx_v_objs;
  goto __pyx_L0;

  /* "pysobatools/_mask.pyx":137
 * # encode mask to RLEs objects
 * # list of RLE string can be generated by RLEs member function
 * def encode(np.ndarray[np.uint8_t, ndim=3, mode='fortran'] mask):             # <<<<<<<<<<<<<<
 *     h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]
 *     cdef RLEs Rs = RLEs(n)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
    __Pyx_PyThreadState_declare
    __Pyx_PyThreadState_assign
    __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
    __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
  __Pyx_AddTraceback("pysobatools._mask.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  goto __pyx_L2;
  __pyx_L0:;
  __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
  __pyx_L2:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
  __Pyx_XDECREF(__pyx_v_objs);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysobatools/_mask.pyx":145
 * 
 * # decode mask from compressed list of RLE string or RLEs object
 * def decode(rleObjs):             # <<<<<<<<<<<<<<
 *     cdef RLEs Rs = _frString(rleObjs)
 *     h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_7decode(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /*proto*/
static PyMethodDef __pyx_mdef_11pysobatools_5_mask_7decode = {"decode", (PyCFunction)__pyx_pw_11pysobatools_5_mask_7decode, METH_O, 0};
static PyObject *__pyx_pw_11pysobatools_5_mask_7decode(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("decode (wrapper)", 0);
  __pyx_r = __pyx_pf_11pysobatools_5_mask_6decode(__pyx_self, ((PyObject *)__pyx_v_rleObjs));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_11pysobatools_5_mask_6decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
  struct __pyx_obj_11pysobatools_5_mask_RLEs *__pyx_v_Rs = 0;
  siz __pyx_v_h;
  siz __pyx_v_w;
  siz __pyx_v_n;
  struct __pyx_obj_11pysobatools_5_mask_Masks *__pyx_v_masks = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  siz __pyx_t_4;
  siz __pyx_t_5;
  siz __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  __Pyx_RefNannySetupContext("decode", 0);

  /* "pysobatools/_mask.pyx":146
 * # decode mask from compressed list of RLE string or RLEs object
 * def decode(rleObjs):
 *     cdef RLEs Rs = _frString(rleObjs)             # <<<<<<<<<<<<<<
 *     h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
 *     masks = Masks(h, w, n)
 */
  __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_frString); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_rleObjs) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_rleObjs);
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_11pysobatools_5_mask_RLEs))))) __PYX_ERR(0, 146, __pyx_L1_error)
  __pyx_v_Rs = ((struct __pyx_obj_11pysobatools_5_mask_RLEs *)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "pysobatools/_mask.pyx":147
 * def decode(rleObjs):
 *     cdef RLEs Rs = _frString(rleObjs)
 *     h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n             # <<<<<<<<<<<<<<
 *     masks = Masks(h, w, n)
 *     rleDecode(<RLE*>Rs._R, masks._mask, n);
 */
  __pyx_t_4 = (__pyx_v_Rs->_R[0]).h;
  __pyx_t_5 = (__pyx_v_Rs->_R[0]).w;
  __pyx_t_6 = __pyx_v_Rs->_n;
  __pyx_v_h = __pyx_t_4;
  __pyx_v_w = __pyx_t_5;
  __pyx_v_n = __pyx_t_6;

  /* "pysobatools/_mask.pyx":148
 *     cdef RLEs Rs = _frString(rleObjs)
 *     h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
 *     masks = Masks(h, w, n)             # <<<<<<<<<<<<<<
 *     rleDecode(<RLE*>Rs._R, masks._mask, n);
 *     return np.array(masks)
 */
  __pyx_t_1 = __Pyx_PyInt_From_siz(__pyx_v_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyInt_From_siz(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_siz(__pyx_v_n); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_11pysobatools_5_mask_Masks), __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_masks = ((struct __pyx_obj_11pysobatools_5_mask_Masks *)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "pysobatools/_mask.pyx":149
 *     h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
 *     masks = Masks(h, w, n)
 *     rleDecode(<RLE*>Rs._R, masks._mask, n);             # <<<<<<<<<<<<<<
 *     return np.array(masks)
 * 
 */
  rleDecode(((RLE *)__pyx_v_Rs->_R), __pyx_v_masks->_mask, __pyx_v_n);

  /* "pysobatools/_mask.pyx":150
 *     masks = Masks(h, w, n)
 *     rleDecode(<RLE*>Rs._R, masks._mask, n);
 *     return np.array(masks)             # <<<<<<<<<<<<<<
 * 
 * def merge(rleObjs, intersect=0):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  __pyx_t_3 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, ((PyObject *)__pyx_v_masks)) : __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_masks));
  __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "pysobatools/_mask.pyx":145
 * 
 * # decode mask from compressed list of RLE string or RLEs object
 * def decode(rleObjs):             # <<<<<<<<<<<<<<
 *     cdef RLEs Rs = _frString(rleObjs)
 *     h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("pysobatools._mask.decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
  __Pyx_XDECREF((PyObject *)__pyx_v_masks);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "pysobatools/_mask.pyx":152
 *     return np.array(masks)
 * 
 * def merge(rleObjs, intersect=0):             # <<<<<<<<<<<<<<
 *     cdef RLEs Rs = _frString(rleObjs)
 *     cdef RLEs R = RLEs(1)
 */

/* Python wrapper */
static PyObject *__pyx_pw_11pysobatools_5_mask_9merge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_11pysobatools_5_mask_9merge = {"merge", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_11pysobatools_5_mask_9merge, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_11pysobatools_5_mask_9merge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_rleObjs = 0;
  PyObject *__pyx_v_intersect = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("merge (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rleObjs,&__pyx_n_s_intersect,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)__pyx_int_0);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        CYTHON_FALLTHROUGH;
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rleObjs)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        CYTHON_FALLTHROUGH;
        case  1:
        if (kw_args > 0) {
          PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_intersect);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merge") < 0)) __PYX_ERR(0, 152, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        CYTHON_FALLTHROUGH;
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_rleObjs = values[0];
    __pyx_v_intersect = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("merge", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 152, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("pysobatools._mask.merge", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_p
Download .txt
gitextract_46mmgy8a/

├── .gitignore
├── LICENSE
├── PythonAPI/
│   ├── Makefile
│   ├── common/
│   │   ├── gason.cpp
│   │   ├── gason.h
│   │   ├── maskApi.c
│   │   └── maskApi.h
│   ├── pysobatools/
│   │   ├── __init__.py
│   │   ├── _mask.c
│   │   ├── _mask.pyx
│   │   ├── cocoeval.py
│   │   ├── mask.py
│   │   ├── soba.py
│   │   └── sobaeval.py
│   └── setup.py
├── README.md
├── configs/
│   ├── Base-RCNN-C4.yaml
│   ├── Base-RCNN-DilatedC5.yaml
│   ├── Base-RCNN-FPN.yaml
│   ├── Base-RetinaNet.yaml
│   ├── COCO-Detection/
│   │   ├── fast_rcnn_R_50_FPN_1x.yaml
│   │   ├── faster_rcnn_R_101_C4_3x.yaml
│   │   ├── faster_rcnn_R_101_DC5_3x.yaml
│   │   ├── faster_rcnn_R_101_FPN_3x.yaml
│   │   ├── faster_rcnn_R_50_C4_1x.yaml
│   │   ├── faster_rcnn_R_50_C4_3x.yaml
│   │   ├── faster_rcnn_R_50_DC5_1x.yaml
│   │   ├── faster_rcnn_R_50_DC5_3x.yaml
│   │   ├── faster_rcnn_R_50_FPN_1x.yaml
│   │   ├── faster_rcnn_R_50_FPN_3x.yaml
│   │   ├── faster_rcnn_X_101_32x8d_FPN_3x.yaml
│   │   ├── retinanet_R_101_FPN_3x.yaml
│   │   ├── retinanet_R_50_FPN_1x.yaml
│   │   ├── retinanet_R_50_FPN_3x.yaml
│   │   ├── rpn_R_50_C4_1x.yaml
│   │   └── rpn_R_50_FPN_1x.yaml
│   ├── COCO-InstanceSegmentation/
│   │   ├── mask_rcnn_R_101_C4_3x.yaml
│   │   ├── mask_rcnn_R_101_DC5_3x.yaml
│   │   ├── mask_rcnn_R_101_FPN_3x.yaml
│   │   ├── mask_rcnn_R_50_C4_1x.yaml
│   │   ├── mask_rcnn_R_50_C4_3x.yaml
│   │   ├── mask_rcnn_R_50_DC5_1x.yaml
│   │   ├── mask_rcnn_R_50_DC5_3x.yaml
│   │   ├── mask_rcnn_R_50_FPN_1x.yaml
│   │   ├── mask_rcnn_R_50_FPN_3x.yaml
│   │   └── mask_rcnn_X_101_32x8d_FPN_3x.yaml
│   ├── COCO-Keypoints/
│   │   ├── Base-Keypoint-RCNN-FPN.yaml
│   │   ├── keypoint_rcnn_R_101_FPN_3x.yaml
│   │   ├── keypoint_rcnn_R_50_FPN_1x.yaml
│   │   ├── keypoint_rcnn_R_50_FPN_3x.yaml
│   │   └── keypoint_rcnn_X_101_32x8d_FPN_3x.yaml
│   ├── COCO-PanopticSegmentation/
│   │   ├── Base-Panoptic-FPN.yaml
│   │   ├── panoptic_fpn_R_101_3x.yaml
│   │   ├── panoptic_fpn_R_50_1x.yaml
│   │   └── panoptic_fpn_R_50_3x.yaml
│   ├── Cityscapes/
│   │   └── mask_rcnn_R_50_FPN.yaml
│   ├── Detectron1-Comparisons/
│   │   ├── README.md
│   │   ├── faster_rcnn_R_50_FPN_noaug_1x.yaml
│   │   ├── keypoint_rcnn_R_50_FPN_1x.yaml
│   │   └── mask_rcnn_R_50_FPN_noaug_1x.yaml
│   ├── LVIS-InstanceSegmentation/
│   │   ├── mask_rcnn_R_101_FPN_1x.yaml
│   │   ├── mask_rcnn_R_50_FPN_1x.yaml
│   │   └── mask_rcnn_X_101_32x8d_FPN_1x.yaml
│   ├── Misc/
│   │   ├── cascade_mask_rcnn_R_50_FPN_1x.yaml
│   │   ├── cascade_mask_rcnn_R_50_FPN_3x.yaml
│   │   ├── cascade_mask_rcnn_X_152_32x8d_FPN_IN5k_gn_dconv.yaml
│   │   ├── mask_rcnn_R_50_FPN_1x_cls_agnostic.yaml
│   │   ├── mask_rcnn_R_50_FPN_1x_dconv_c3-c5.yaml
│   │   ├── mask_rcnn_R_50_FPN_3x_dconv_c3-c5.yaml
│   │   ├── mask_rcnn_R_50_FPN_3x_gn.yaml
│   │   ├── mask_rcnn_R_50_FPN_3x_syncbn.yaml
│   │   ├── panoptic_fpn_R_101_dconv_cascade_gn_3x.yaml
│   │   ├── scratch_mask_rcnn_R_50_FPN_3x_gn.yaml
│   │   └── semantic_R_50_FPN_1x.yaml
│   ├── PascalVOC-Detection/
│   │   ├── faster_rcnn_R_50_C4.yaml
│   │   └── faster_rcnn_R_50_FPN.yaml
│   └── quick_schedules/
│       ├── README.md
│       ├── fast_rcnn_R_50_FPN_inference_acc_test.yaml
│       ├── fast_rcnn_R_50_FPN_instant_test.yaml
│       ├── keypoint_rcnn_R_50_FPN_inference_acc_test.yaml
│       ├── keypoint_rcnn_R_50_FPN_instant_test.yaml
│       ├── keypoint_rcnn_R_50_FPN_normalized_training_acc_test.yaml
│       ├── keypoint_rcnn_R_50_FPN_training_acc_test.yaml
│       ├── mask_rcnn_R_50_C4_inference_acc_test.yaml
│       ├── mask_rcnn_R_50_C4_instant_test.yaml
│       ├── mask_rcnn_R_50_C4_training_acc_test.yaml
│       ├── mask_rcnn_R_50_DC5_inference_acc_test.yaml
│       ├── mask_rcnn_R_50_FPN_inference_acc_test.yaml
│       ├── mask_rcnn_R_50_FPN_instant_test.yaml
│       ├── mask_rcnn_R_50_FPN_training_acc_test.yaml
│       ├── panoptic_fpn_R_50_inference_acc_test.yaml
│       ├── panoptic_fpn_R_50_instant_test.yaml
│       ├── panoptic_fpn_R_50_training_acc_test.yaml
│       ├── retinanet_R_50_FPN_inference_acc_test.yaml
│       ├── retinanet_R_50_FPN_instant_test.yaml
│       ├── rpn_R_50_FPN_inference_acc_test.yaml
│       ├── rpn_R_50_FPN_instant_test.yaml
│       ├── semantic_R_50_FPN_inference_acc_test.yaml
│       ├── semantic_R_50_FPN_instant_test.yaml
│       └── semantic_R_50_FPN_training_acc_test.yaml
├── datasets/
│   ├── README.md
│   ├── prepare_for_tests.sh
│   └── prepare_panoptic_fpn.py
├── demo/
│   ├── README.md
│   ├── demo.py
│   └── predictor.py
├── detectron2/
│   ├── __init__.py
│   ├── checkpoint/
│   │   ├── __init__.py
│   │   ├── c2_model_loading.py
│   │   ├── catalog.py
│   │   ├── detection_checkpoint.py
│   │   └── model_zoo.py
│   ├── config/
│   │   ├── __init__.py
│   │   ├── compat.py
│   │   ├── config.py
│   │   └── defaults.py
│   ├── data/
│   │   ├── __init__.py
│   │   ├── build.py
│   │   ├── catalog.py
│   │   ├── common.py
│   │   ├── dataset_mapper.py
│   │   ├── dataset_mapper.py.bak
│   │   ├── datasets/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── builtin.py
│   │   │   ├── builtin_meta.py
│   │   │   ├── cityscapes.py
│   │   │   ├── coco.py
│   │   │   ├── lvis.py
│   │   │   ├── lvis_v0_5_categories.py
│   │   │   ├── pascal_voc.py
│   │   │   ├── register_coco.py
│   │   │   ├── register_soba.py
│   │   │   └── soba.py
│   │   ├── detection_utils.py
│   │   ├── samplers/
│   │   │   ├── __init__.py
│   │   │   ├── distributed_sampler.py
│   │   │   └── grouped_batch_sampler.py
│   │   └── transforms/
│   │       ├── __init__.py
│   │       ├── transform.py
│   │       └── transform_gen.py
│   ├── engine/
│   │   ├── __init__.py
│   │   ├── defaults.py
│   │   ├── hooks.py
│   │   ├── launch.py
│   │   └── train_loop.py
│   ├── evaluation/
│   │   ├── __init__.py
│   │   ├── cityscapes_evaluation.py
│   │   ├── coco_evaluation.py
│   │   ├── evaluation/
│   │   │   ├── __init__.py
│   │   │   ├── cityscapes_evaluation.py
│   │   │   ├── coco_evaluation.py
│   │   │   ├── evaluator.py
│   │   │   ├── lvis_evaluation.py
│   │   │   ├── panoptic_evaluation.py
│   │   │   ├── pascal_voc_evaluation.py
│   │   │   ├── sem_seg_evaluation.py
│   │   │   └── testing.py
│   │   ├── evaluator.py
│   │   ├── lvis_evaluation.py
│   │   ├── panoptic_evaluation.py
│   │   ├── pascal_voc_evaluation.py
│   │   ├── rotated_coco_evaluation.py
│   │   ├── sem_seg_evaluation.py
│   │   ├── soba_evaluation.py
│   │   └── testing.py
│   ├── export/
│   │   ├── README.md
│   │   ├── __init__.py
│   │   ├── api.py
│   │   ├── c10.py
│   │   ├── caffe2_export.py
│   │   ├── caffe2_inference.py
│   │   ├── caffe2_modeling.py
│   │   ├── patcher.py
│   │   └── shared.py
│   ├── layers/
│   │   ├── __init__.py
│   │   ├── aspp.py
│   │   ├── batch_norm.py
│   │   ├── blocks.py
│   │   ├── csrc/
│   │   │   ├── README.md
│   │   │   ├── ROIAlignRotated/
│   │   │   │   ├── ROIAlignRotated.h
│   │   │   │   ├── ROIAlignRotated_cpu.cpp
│   │   │   │   └── ROIAlignRotated_cuda.cu
│   │   │   ├── box_iou_rotated/
│   │   │   │   ├── box_iou_rotated.h
│   │   │   │   ├── box_iou_rotated_cpu.cpp
│   │   │   │   ├── box_iou_rotated_cuda.cu
│   │   │   │   └── box_iou_rotated_utils.h
│   │   │   ├── cocoeval/
│   │   │   │   ├── cocoeval.cpp
│   │   │   │   └── cocoeval.h
│   │   │   ├── cuda_version.cu
│   │   │   ├── deformable/
│   │   │   │   ├── deform_conv.h
│   │   │   │   ├── deform_conv_cuda.cu
│   │   │   │   └── deform_conv_cuda_kernel.cu
│   │   │   ├── nms_rotated/
│   │   │   │   ├── nms_rotated.h
│   │   │   │   ├── nms_rotated_cpu.cpp
│   │   │   │   └── nms_rotated_cuda.cu
│   │   │   └── vision.cpp
│   │   ├── deform_conv.py
│   │   ├── losses.py
│   │   ├── mask_ops.py
│   │   ├── nms.py
│   │   ├── roi_align.py
│   │   ├── roi_align_rotated.py
│   │   ├── rotated_boxes.py
│   │   ├── shape_spec.py
│   │   └── wrappers.py
│   ├── modeling/
│   │   ├── __init__.py
│   │   ├── anchor_generator.py
│   │   ├── backbone/
│   │   │   ├── __init__.py
│   │   │   ├── backbone.py
│   │   │   ├── build.py
│   │   │   ├── fpn.py
│   │   │   └── resnet.py
│   │   ├── box_regression.py
│   │   ├── matcher.py
│   │   ├── meta_arch/
│   │   │   ├── LISA_meta_arch.py
│   │   │   ├── __init__.py
│   │   │   ├── build.py
│   │   │   ├── panoptic_fpn.py
│   │   │   ├── rcnn.py
│   │   │   ├── retinanet.py
│   │   │   └── semantic_seg.py
│   │   ├── poolers.py
│   │   ├── postprocessing.py
│   │   ├── proposal_generator/
│   │   │   ├── LISA_rpn.py
│   │   │   ├── __init__.py
│   │   │   ├── build.py
│   │   │   ├── proposal_utils.py
│   │   │   ├── rpn.py
│   │   │   ├── rpn_outputs.py
│   │   │   ├── rrpn.py
│   │   │   └── rrpn_outputs.py
│   │   ├── roi_heads/
│   │   │   ├── LISA_rcnn.py
│   │   │   ├── __init__.py
│   │   │   ├── box_head.py
│   │   │   ├── cascade_rcnn.py
│   │   │   ├── fast_rcnn.py
│   │   │   ├── keypoint_head.py
│   │   │   ├── mask_head.py
│   │   │   ├── roi_heads.py
│   │   │   └── rotated_fast_rcnn.py
│   │   ├── sampling.py
│   │   └── test_time_augmentation.py
│   ├── solver/
│   │   ├── __init__.py
│   │   ├── build.py
│   │   └── lr_scheduler.py
│   ├── structures/
│   │   ├── __init__.py
│   │   ├── boxes.py
│   │   ├── image_list.py
│   │   ├── instances.py
│   │   ├── keypoints.py
│   │   ├── masks.py
│   │   └── rotated_boxes.py
│   └── utils/
│       ├── README.md
│       ├── __init__.py
│       ├── collect_env.py
│       ├── colormap.py
│       ├── comm.py
│       ├── develop.py
│       ├── env.py
│       ├── events.py
│       ├── logger.py
│       ├── memory.py
│       ├── registry.py
│       ├── serialize.py
│       ├── video_visualizer.py
│       ├── visualizer.py
│       └── visualizer.py.back
├── dev/
│   ├── README.md
│   ├── linter.sh
│   ├── packaging/
│   │   ├── README.md
│   │   ├── build_all_wheels.sh
│   │   ├── build_wheel.sh
│   │   ├── gen_wheel_index.sh
│   │   └── pkg_helpers.bash
│   ├── parse_results.sh
│   ├── run_inference_tests.sh
│   └── run_instant_tests.sh
├── docker/
│   ├── Dockerfile
│   ├── Dockerfile-circleci
│   └── docker-compose.yml
├── docs/
│   ├── .gitignore
│   ├── Makefile
│   ├── README.md
│   ├── conf.py
│   ├── index.rst
│   ├── modules/
│   │   ├── checkpoint.rst
│   │   ├── config.rst
│   │   ├── data.rst
│   │   ├── engine.rst
│   │   ├── evaluation.rst
│   │   ├── export.rst
│   │   ├── index.rst
│   │   ├── layers.rst
│   │   ├── model_zoo.rst
│   │   ├── modeling.rst
│   │   ├── solver.rst
│   │   ├── structures.rst
│   │   └── utils.rst
│   ├── notes/
│   │   ├── benchmarks.md
│   │   ├── changelog.md
│   │   ├── compatibility.md
│   │   └── index.rst
│   └── tutorials/
│       ├── README.md
│       ├── configs.md
│       ├── data_loading.md
│       ├── datasets.md
│       ├── deployment.md
│       ├── evaluation.md
│       ├── extend.md
│       ├── index.rst
│       ├── models.md
│       ├── training.md
│       └── write-models.md
├── projects/
│   └── LISA/
│       ├── LISA/
│       │   ├── LISA_meta_arch.py
│       │   ├── LISA_rcnn.py
│       │   ├── LISA_rpn.py
│       │   ├── __init__.py
│       │   └── config.py
│       ├── SOAP.py
│       ├── __init__.py
│       ├── config/
│       │   ├── Base-RCNN-FPN.yaml
│       │   ├── LISA_101_FPN_3x.yaml
│       │   └── LISA_101_FPN_3x_demo.yaml
│       ├── defaults.py
│       ├── demo.py
│       ├── output_light/
│       │   ├── inference/
│       │   │   ├── soba_association_results.json
│       │   │   └── soba_instances_results.json
│       │   └── last_checkpoint
│       ├── predictor.py
│       ├── train_net.py
│       ├── utils.py
│       ├── visualize_data.py
│       └── visualize_json_results.py
├── setup.cfg
├── setup.py
└── tests/
    ├── README.md
    ├── __init__.py
    ├── test_anchor_generator.py
    ├── test_box2box_transform.py
    ├── test_boxes.py
    ├── test_checkpoint.py
    ├── test_config.py
    ├── test_data_loader.py
    ├── test_data_transform.py
    ├── test_fast_rcnn.py
    ├── test_mask_ops.py
    ├── test_model_e2e.py
    ├── test_model_zoo.py
    ├── test_nms_rotated.py
    ├── test_roi_align.py
    ├── test_roi_align_rotated.py
    ├── test_roi_heads.py
    ├── test_roi_pooler.py
    ├── test_rotated_boxes.py
    ├── test_rpn.py
    ├── test_sampler.py
    └── test_visualizer.py
Download .txt
SYMBOL INDEX (1896 symbols across 173 files)

FILE: PythonAPI/common/gason.cpp
  function isspace (line 52) | static inline bool isspace(char c) {
  function isdelim (line 56) | static inline bool isdelim(char c) {
  function isdigit (line 60) | static inline bool isdigit(char c) {
  function isxdigit (line 64) | static inline bool isxdigit(char c) {
  function char2int (line 68) | static inline int char2int(char c) {
  function string2double (line 74) | static double string2double(char *s, char **endptr) {
  function JsonNode (line 120) | static inline JsonNode *insertAfter(JsonNode *tail, JsonNode *node) {
  function JsonValue (line 128) | static inline JsonValue listToValue(JsonTag tag, JsonNode *tail) {
  function jsonParse (line 137) | int jsonParse(char *s, char **endptr, JsonValue *value, JsonAllocator &a...

FILE: PythonAPI/common/gason.h
  type JsonTag (line 8) | enum JsonTag {
  type JsonNode (line 18) | struct JsonNode
  function JsonNode (line 54) | JsonNode *toNode() const {
  type JsonNode (line 60) | struct JsonNode {
  type JsonIterator (line 66) | struct JsonIterator {
  function JsonIterator (line 86) | inline JsonIterator end(JsonValue) {

FILE: PythonAPI/common/maskApi.c
  function uint (line 11) | uint umin( uint a, uint b ) { return (a<b) ? a : b; }
  function uint (line 12) | uint umax( uint a, uint b ) { return (a>b) ? a : b; }
  function rleInit (line 14) | void rleInit( RLE *R, siz h, siz w, siz m, uint *cnts ) {
  function rleFree (line 19) | void rleFree( RLE *R ) {
  function rlesInit (line 23) | void rlesInit( RLE **R, siz n ) {
  function rlesFree (line 28) | void rlesFree( RLE **R, siz n ) {
  function rleEncode (line 32) | void rleEncode( RLE *R, const byte *M, siz h, siz w, siz n ) {
  function rleDecode (line 43) | void rleDecode( const RLE *R, byte *M, siz n ) {
  function rleMerge (line 49) | void rleMerge( const RLE *R, RLE *M, siz n, int intersect ) {
  function rleArea (line 72) | void rleArea( const RLE *R, siz n, uint *a ) {
  function rleIou (line 77) | void rleIou( RLE *dt, RLE *gt, siz m, siz n, byte *iscrowd, double *o ) {
  function rleNms (line 98) | void rleNms( RLE *dt, siz n, uint *keep, double thr ) {
  function bbIou (line 109) | void bbIou( BB dt, BB gt, siz m, siz n, byte *iscrowd, double *o ) {
  function bbNms (line 122) | void bbNms( BB dt, siz n, uint *keep, double thr ) {
  function rleToBbox (line 133) | void rleToBbox( const RLE *R, BB bb, siz n ) {
  function rleFrBbox (line 149) | void rleFrBbox( RLE *R, const BB bb, siz h, siz w, siz n ) {
  function uintCompare (line 158) | int uintCompare(const void *a, const void *b) {
  function rleFrPoly (line 162) | void rleFrPoly( RLE *R, const double *xy, siz k, siz h, siz w ) {
  function rleFrString (line 218) | void rleFrString( RLE *R, char *s, siz h, siz w ) {

FILE: PythonAPI/common/maskApi.h
  type uint (line 9) | typedef unsigned int uint;
  type siz (line 10) | typedef unsigned long siz;
  type byte (line 11) | typedef unsigned char byte;
  type RLE (line 13) | typedef struct { siz h, w, m; uint *cnts; } RLE;

FILE: PythonAPI/pysobatools/_mask.c
  type PyObject (line 341) | typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *co...
  type PyObject (line 342) | typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, ...
  type Py_tss_t (line 383) | typedef int Py_tss_t;
  function CYTHON_INLINE (line 384) | static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
  function CYTHON_INLINE (line 388) | static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
  function CYTHON_INLINE (line 393) | static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
  function CYTHON_INLINE (line 396) | static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
  function CYTHON_INLINE (line 399) | static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
  function CYTHON_INLINE (line 403) | static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
  function CYTHON_INLINE (line 406) | static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
  type Py_hash_t (line 530) | typedef long Py_hash_t;
  type __Pyx_PyAsyncMethodsStruct (line 553) | typedef struct {
  function CYTHON_INLINE (line 567) | static CYTHON_INLINE float __PYX_NAN() {
  type __Pyx_StringTabEntry (line 610) | typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const c...
  function CYTHON_INLINE (line 631) | static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t l...
  function CYTHON_INLINE (line 680) | static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
  function __Pyx_init_sys_getdefaultencoding_params (line 712) | static int __Pyx_init_sys_getdefaultencoding_params(void) {
  function __Pyx_init_sys_getdefaultencoding_params (line 762) | static int __Pyx_init_sys_getdefaultencoding_params(void) {
  function CYTHON_INLINE (line 794) | static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void...
  type __Pyx_StructField_ (line 839) | struct __Pyx_StructField_
  type __Pyx_TypeInfo (line 841) | typedef struct {
  type __Pyx_StructField (line 851) | typedef struct __Pyx_StructField_ {
  type __Pyx_BufFmt_StackElem (line 856) | typedef struct {
  type __Pyx_BufFmt_Context (line 860) | typedef struct {
  type npy_int8 (line 881) | typedef npy_int8 __pyx_t_5numpy_int8_t;
  type npy_int16 (line 890) | typedef npy_int16 __pyx_t_5numpy_int16_t;
  type npy_int32 (line 899) | typedef npy_int32 __pyx_t_5numpy_int32_t;
  type npy_int64 (line 908) | typedef npy_int64 __pyx_t_5numpy_int64_t;
  type npy_uint8 (line 917) | typedef npy_uint8 __pyx_t_5numpy_uint8_t;
  type npy_uint16 (line 926) | typedef npy_uint16 __pyx_t_5numpy_uint16_t;
  type npy_uint32 (line 935) | typedef npy_uint32 __pyx_t_5numpy_uint32_t;
  type npy_uint64 (line 944) | typedef npy_uint64 __pyx_t_5numpy_uint64_t;
  type npy_float32 (line 953) | typedef npy_float32 __pyx_t_5numpy_float32_t;
  type npy_float64 (line 962) | typedef npy_float64 __pyx_t_5numpy_float64_t;
  type npy_long (line 971) | typedef npy_long __pyx_t_5numpy_int_t;
  type npy_longlong (line 980) | typedef npy_longlong __pyx_t_5numpy_long_t;
  type npy_longlong (line 989) | typedef npy_longlong __pyx_t_5numpy_longlong_t;
  type npy_ulong (line 998) | typedef npy_ulong __pyx_t_5numpy_uint_t;
  type npy_ulonglong (line 1007) | typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
  type npy_ulonglong (line 1016) | typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
  type npy_intp (line 1025) | typedef npy_intp __pyx_t_5numpy_intp_t;
  type npy_uintp (line 1034) | typedef npy_uintp __pyx_t_5numpy_uintp_t;
  type npy_double (line 1043) | typedef npy_double __pyx_t_5numpy_float_t;
  type npy_double (line 1052) | typedef npy_double __pyx_t_5numpy_double_t;
  type npy_longdouble (line 1061) | typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
  type std (line 1065) | typedef ::std::complex< float > __pyx_t_float_complex;
  type __pyx_t_float_complex (line 1067) | typedef float _Complex __pyx_t_float_complex;
  type __pyx_t_float_complex (line 1070) | typedef struct { float real, imag; } __pyx_t_float_complex;
  type std (line 1077) | typedef ::std::complex< double > __pyx_t_double_complex;
  type __pyx_t_double_complex (line 1079) | typedef double _Complex __pyx_t_double_complex;
  type __pyx_t_double_complex (line 1082) | typedef struct { double real, imag; } __pyx_t_double_complex;
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 1088) | struct __pyx_obj_11pysobatools_5_mask_RLEs
  type __pyx_obj_11pysobatools_5_mask_Masks (line 1089) | struct __pyx_obj_11pysobatools_5_mask_Masks
  type npy_cfloat (line 1098) | typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
  type npy_cdouble (line 1107) | typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
  type npy_clongdouble (line 1116) | typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
  type npy_cdouble (line 1125) | typedef npy_cdouble __pyx_t_5numpy_complex_t;
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 1134) | struct __pyx_obj_11pysobatools_5_mask_RLEs {
  type __pyx_obj_11pysobatools_5_mask_Masks (line 1148) | struct __pyx_obj_11pysobatools_5_mask_Masks {
  type __Pyx_RefNannyAPIStruct (line 1163) | typedef struct {
  function CYTHON_INLINE (line 1354) | static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
  function CYTHON_INLINE (line 1486) | static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject*...
  type __pyx_CyFunctionObject (line 1517) | typedef struct {
  function CYTHON_INLINE (line 1569) | static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyO...
  type __Pyx_ImportType_CheckSize (line 1635) | enum __Pyx_ImportType_CheckSize {
  type __Pyx_ImportType_CheckSize (line 1640) | enum __Pyx_ImportType_CheckSize
  type __Pyx_CodeObjectCacheEntry (line 1654) | typedef struct {
  type __Pyx_CodeObjectCache (line 1658) | struct __Pyx_CodeObjectCache {
  type __Pyx_CodeObjectCache (line 1663) | struct __Pyx_CodeObjectCache
  type __Pyx_Buf_DimInfo (line 1673) | typedef struct {
  type __Pyx_Buffer (line 1676) | typedef struct {
  type __Pyx_LocalBuf_ND (line 1680) | typedef struct {
  type NPY_TYPES (line 1806) | enum NPY_TYPES
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 2122) | struct __pyx_obj_11pysobatools_5_mask_RLEs
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 2123) | struct __pyx_obj_11pysobatools_5_mask_RLEs
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 2124) | struct __pyx_obj_11pysobatools_5_mask_RLEs
  type __pyx_obj_11pysobatools_5_mask_Masks (line 2127) | struct __pyx_obj_11pysobatools_5_mask_Masks
  type __pyx_obj_11pysobatools_5_mask_Masks (line 2128) | struct __pyx_obj_11pysobatools_5_mask_Masks
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 2131) | struct __pyx_obj_11pysobatools_5_mask_RLEs
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 2138) | struct __pyx_obj_11pysobatools_5_mask_RLEs
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 2138) | struct __pyx_obj_11pysobatools_5_mask_RLEs
  function __pyx_pw_11pysobatools_5_mask_4RLEs_1__cinit__ (line 2219) | static int __pyx_pw_11pysobatools_5_mask_4RLEs_1__cinit__(PyObject *__py...
  function __pyx_pf_11pysobatools_5_mask_4RLEs___cinit__ (line 2276) | static int __pyx_pf_11pysobatools_5_mask_4RLEs___cinit__(struct __pyx_ob...
  function __pyx_pw_11pysobatools_5_mask_4RLEs_3__dealloc__ (line 2323) | static void __pyx_pw_11pysobatools_5_mask_4RLEs_3__dealloc__(PyObject *_...
  function __pyx_pf_11pysobatools_5_mask_4RLEs_2__dealloc__ (line 2332) | static void __pyx_pf_11pysobatools_5_mask_4RLEs_2__dealloc__(struct __py...
  function PyObject (line 2413) | static PyObject *__pyx_pw_11pysobatools_5_mask_4RLEs_5__getattr__(PyObje...
  function PyObject (line 2424) | static PyObject *__pyx_pf_11pysobatools_5_mask_4RLEs_4__getattr__(struct...
  function PyObject (line 2504) | static PyObject *__pyx_pw_11pysobatools_5_mask_4RLEs_7__reduce_cython__(...
  function PyObject (line 2515) | static PyObject *__pyx_pf_11pysobatools_5_mask_4RLEs_6__reduce_cython__(...
  function PyObject (line 2558) | static PyObject *__pyx_pw_11pysobatools_5_mask_4RLEs_9__setstate_cython_...
  function PyObject (line 2569) | static PyObject *__pyx_pf_11pysobatools_5_mask_4RLEs_8__setstate_cython_...
  function __pyx_pw_11pysobatools_5_mask_5Masks_1__cinit__ (line 2613) | static int __pyx_pw_11pysobatools_5_mask_5Masks_1__cinit__(PyObject *__p...
  function __pyx_pf_11pysobatools_5_mask_5Masks___cinit__ (line 2683) | static int __pyx_pf_11pysobatools_5_mask_5Masks___cinit__(struct __pyx_o...
  function PyObject (line 2777) | static PyObject *__pyx_pw_11pysobatools_5_mask_5Masks_3__array__(PyObjec...
  function PyObject (line 2788) | static PyObject *__pyx_pf_11pysobatools_5_mask_5Masks_2__array__(struct ...
  function PyObject (line 2908) | static PyObject *__pyx_pw_11pysobatools_5_mask_5Masks_5__reduce_cython__...
  function PyObject (line 2919) | static PyObject *__pyx_pf_11pysobatools_5_mask_5Masks_4__reduce_cython__...
  function PyObject (line 2962) | static PyObject *__pyx_pw_11pysobatools_5_mask_5Masks_7__setstate_cython...
  function PyObject (line 2973) | static PyObject *__pyx_pf_11pysobatools_5_mask_5Masks_6__setstate_cython...
  function PyObject (line 3018) | static PyObject *__pyx_pw_11pysobatools_5_mask_1_toString(PyObject *__py...
  function PyObject (line 3034) | static PyObject *__pyx_pf_11pysobatools_5_mask__toString(CYTHON_UNUSED P...
  function PyObject (line 3210) | static PyObject *__pyx_pw_11pysobatools_5_mask_3_frString(PyObject *__py...
  function PyObject (line 3221) | static PyObject *__pyx_pf_11pysobatools_5_mask_2_frString(CYTHON_UNUSED ...
  function PyObject (line 3579) | static PyObject *__pyx_pw_11pysobatools_5_mask_5encode(PyObject *__pyx_s...
  function PyObject (line 3595) | static PyObject *__pyx_pf_11pysobatools_5_mask_4encode(CYTHON_UNUSED PyO...
  function PyObject (line 3742) | static PyObject *__pyx_pw_11pysobatools_5_mask_7decode(PyObject *__pyx_s...
  function PyObject (line 3753) | static PyObject *__pyx_pf_11pysobatools_5_mask_6decode(CYTHON_UNUSED PyO...
  function PyObject (line 3918) | static PyObject *__pyx_pw_11pysobatools_5_mask_9merge(PyObject *__pyx_se...
  function PyObject (line 3981) | static PyObject *__pyx_pf_11pysobatools_5_mask_8merge(CYTHON_UNUSED PyOb...
  function PyObject (line 4120) | static PyObject *__pyx_pw_11pysobatools_5_mask_11area(PyObject *__pyx_se...
  function PyObject (line 4131) | static PyObject *__pyx_pf_11pysobatools_5_mask_10area(CYTHON_UNUSED PyOb...
  function PyObject (line 4311) | static PyObject *__pyx_pw_11pysobatools_5_mask_13iou(PyObject *__pyx_sel...
  function PyObject (line 4392) | static PyObject *__pyx_pw_11pysobatools_5_mask_3iou_1_preproc(PyObject *...
  function PyObject (line 4403) | static PyObject *__pyx_pf_11pysobatools_5_mask_3iou__preproc(CYTHON_UNUS...
  function PyObject (line 5124) | static PyObject *__pyx_pw_11pysobatools_5_mask_3iou_3_rleIou(PyObject *_...
  function PyObject (line 5235) | static PyObject *__pyx_pf_11pysobatools_5_mask_3iou_2_rleIou(CYTHON_UNUS...
  function PyObject (line 5313) | static PyObject *__pyx_pw_11pysobatools_5_mask_3iou_5_bbIou(PyObject *__...
  function PyObject (line 5424) | static PyObject *__pyx_pf_11pysobatools_5_mask_3iou_4_bbIou(CYTHON_UNUSE...
  function PyObject (line 5528) | static PyObject *__pyx_pw_11pysobatools_5_mask_3iou_7_len(PyObject *__py...
  function PyObject (line 5539) | static PyObject *__pyx_pf_11pysobatools_5_mask_3iou_6_len(CYTHON_UNUSED ...
  function PyObject (line 5687) | static PyObject *__pyx_pf_11pysobatools_5_mask_12iou(CYTHON_UNUSED PyObj...
  function PyObject (line 6278) | static PyObject *__pyx_pw_11pysobatools_5_mask_15toBbox(PyObject *__pyx_...
  function PyObject (line 6289) | static PyObject *__pyx_pf_11pysobatools_5_mask_14toBbox(CYTHON_UNUSED Py...
  function PyObject (line 6516) | static PyObject *__pyx_pw_11pysobatools_5_mask_17frBbox(PyObject *__pyx_...
  function PyObject (line 6591) | static PyObject *__pyx_pf_11pysobatools_5_mask_16frBbox(CYTHON_UNUSED Py...
  function PyObject (line 6728) | static PyObject *__pyx_pw_11pysobatools_5_mask_19frPoly(PyObject *__pyx_...
  function PyObject (line 6798) | static PyObject *__pyx_pf_11pysobatools_5_mask_18frPoly(CYTHON_UNUSED Py...
  function PyObject (line 7080) | static PyObject *__pyx_pw_11pysobatools_5_mask_21frUncompressedRLE(PyObj...
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 7157) | struct __pyx_obj_11pysobatools_5_mask_RLEs
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 7232) | struct __pyx_obj_11pysobatools_5_mask_RLEs
  function PyObject (line 7468) | static PyObject *__pyx_pw_11pysobatools_5_mask_23frPyObjects(PyObject *_...
  function PyObject (line 7538) | static PyObject *__pyx_pf_11pysobatools_5_mask_22frPyObjects(CYTHON_UNUS...
  function CYTHON_UNUSED (line 8340) | static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObjec...
  function __pyx_pf_5numpy_7ndarray___getbuffer__ (line 8351) | static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v...
  function CYTHON_UNUSED (line 9104) | static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(Py...
  function __pyx_pf_5numpy_7ndarray_2__releasebuffer__ (line 9113) | static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *_...
  function CYTHON_INLINE (line 9194) | static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyOb...
  function CYTHON_INLINE (line 9241) | static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyOb...
  function CYTHON_INLINE (line 9288) | static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyOb...
  function CYTHON_INLINE (line 9335) | static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyOb...
  function CYTHON_INLINE (line 9382) | static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyOb...
  function CYTHON_INLINE (line 9429) | static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyDataType_SHAPE(PyArray_D...
  function CYTHON_INLINE (line 9503) | static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Desc...
  function CYTHON_INLINE (line 10249) | static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *_...
  function CYTHON_INLINE (line 10291) | static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObje...
  function CYTHON_INLINE (line 10372) | static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
  function CYTHON_INLINE (line 10501) | static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
  function CYTHON_INLINE (line 10630) | static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
  function PyObject (line 10748) | static PyObject *__pyx_tp_new_11pysobatools_5_mask_RLEs(PyTypeObject *t,...
  function __pyx_tp_dealloc_11pysobatools_5_mask_RLEs (line 10763) | static void __pyx_tp_dealloc_11pysobatools_5_mask_RLEs(PyObject *o) {
  function PyObject (line 10780) | static PyObject *__pyx_tp_getattro_11pysobatools_5_mask_RLEs(PyObject *o...
  type __pyx_obj_11pysobatools_5_mask_RLEs (line 10799) | struct __pyx_obj_11pysobatools_5_mask_RLEs
  function PyObject (line 10857) | static PyObject *__pyx_tp_new_11pysobatools_5_mask_Masks(PyTypeObject *t...
  function __pyx_tp_dealloc_11pysobatools_5_mask_Masks (line 10872) | static void __pyx_tp_dealloc_11pysobatools_5_mask_Masks(PyObject *o) {
  type __pyx_obj_11pysobatools_5_mask_Masks (line 10891) | struct __pyx_obj_11pysobatools_5_mask_Masks
  type PyModuleDef (line 10964) | struct PyModuleDef
  function CYTHON_SMALL_CODE (line 11113) | static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
  function CYTHON_SMALL_CODE (line 11126) | static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
  function CYTHON_SMALL_CODE (line 11530) | static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
  function __Pyx_modinit_global_init_code (line 11550) | static int __Pyx_modinit_global_init_code(void) {
  function __Pyx_modinit_variable_export_code (line 11558) | static int __Pyx_modinit_variable_export_code(void) {
  function __Pyx_modinit_function_export_code (line 11566) | static int __Pyx_modinit_function_export_code(void) {
  function __Pyx_modinit_type_init_code (line 11574) | static int __Pyx_modinit_type_init_code(void) {
  function __Pyx_modinit_type_import_code (line 11602) | static int __Pyx_modinit_type_import_code(void) {
  function __Pyx_modinit_variable_import_code (line 11639) | static int __Pyx_modinit_variable_import_code(void) {
  function __Pyx_modinit_function_import_code (line 11647) | static int __Pyx_modinit_function_import_code(void) {
  function __Pyx_PyMODINIT_FUNC (line 11676) | __Pyx_PyMODINIT_FUNC PyInit__mask(void)
  function CYTHON_SMALL_CODE (line 11681) | static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
  function CYTHON_SMALL_CODE (line 11704) | static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, P...
  function CYTHON_SMALL_CODE (line 11719) | static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CY...
  function __Pyx_RefNannyAPIStruct (line 12104) | static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modn...
  function CYTHON_INLINE (line 12121) | static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, ...
  function PyObject (line 12134) | static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
  function __Pyx_RaiseDoubleKeywordsError (line 12148) | static void __Pyx_RaiseDoubleKeywordsError(
  function __Pyx_ParseOptionalKeywords (line 12162) | static int __Pyx_ParseOptionalKeywords(
  function __Pyx_RaiseArgtupleInvalid (line 12264) | static void __Pyx_RaiseArgtupleInvalid(
  function CYTHON_INLINE (line 12290) | static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2...
  function CYTHON_INLINE (line 12337) | static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* ...
  function CYTHON_INLINE (line 12440) | static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *fun...
  function PyObject (line 12463) | static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObjec...
  function CYTHON_INLINE (line 12582) | static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObj...
  function CYTHON_INLINE (line 12602) | static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, ...
  function PyObject (line 12622) | static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *ar...
  function CYTHON_INLINE (line 12632) | static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func,...
  function CYTHON_INLINE (line 12650) | static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func,...
  function CYTHON_INLINE (line 12662) | static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate,...
  function CYTHON_INLINE (line 12674) | static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, P...
  function __Pyx_Raise (line 12686) | static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
  function __Pyx_Raise (line 12737) | static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, P...
  function CYTHON_INLINE (line 12844) | static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *typ...
  function __Pyx__ArgTypeTest (line 12857) | static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const c...
  function PyObject (line 12879) | static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHO...
  function CYTHON_INLINE (line 13002) | static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObjec...
  function CYTHON_INLINE (line 13070) | static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
  function CYTHON_INLINE (line 13074) | static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject ...
  function CYTHON_INLINE (line 13086) | static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj...
  function CYTHON_INLINE (line 13098) | static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
  function PyObject (line 13131) | static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
  function CYTHON_UNUSED (line 13154) | static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* functi...
  function PyObject (line 13183) | static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
  function CYTHON_INLINE (line 13190) | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, P...
  function CYTHON_INLINE (line 13208) | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, ...
  function CYTHON_INLINE (line 13226) | static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssi...
  function CYTHON_INLINE (line 13270) | static CYTHON_INLINE int __Pyx_Is_Little_Endian(void)
  function __Pyx_BufFmt_Init (line 13281) | static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
  function __Pyx_BufFmt_ParseNumber (line 13308) | static int __Pyx_BufFmt_ParseNumber(const char** ts) {
  function __Pyx_BufFmt_ExpectNumber (line 13323) | static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
  function __Pyx_BufFmt_RaiseUnexpectedChar (line 13330) | static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
  function __Pyx_BufFmt_TypeCharToStandardSize (line 13358) | static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_comple...
  function __Pyx_BufFmt_TypeCharToNativeSize (line 13376) | static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
  type __Pyx_st_short (line 13395) | typedef struct { char c; short x; } __Pyx_st_short;
  type __Pyx_st_int (line 13396) | typedef struct { char c; int x; } __Pyx_st_int;
  type __Pyx_st_long (line 13397) | typedef struct { char c; long x; } __Pyx_st_long;
  type __Pyx_st_float (line 13398) | typedef struct { char c; float x; } __Pyx_st_float;
  type __Pyx_st_double (line 13399) | typedef struct { char c; double x; } __Pyx_st_double;
  type __Pyx_st_longdouble (line 13400) | typedef struct { char c; long double x; } __Pyx_st_longdouble;
  type __Pyx_st_void_p (line 13401) | typedef struct { char c; void *x; } __Pyx_st_void_p;
  type __Pyx_st_longlong (line 13403) | typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
  function __Pyx_BufFmt_TypeCharToAlignment (line 13405) | static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED in...
  type __Pyx_pad_short (line 13427) | typedef struct { short x; char c; } __Pyx_pad_short;
  type __Pyx_pad_int (line 13428) | typedef struct { int x; char c; } __Pyx_pad_int;
  type __Pyx_pad_long (line 13429) | typedef struct { long x; char c; } __Pyx_pad_long;
  type __Pyx_pad_float (line 13430) | typedef struct { float x; char c; } __Pyx_pad_float;
  type __Pyx_pad_double (line 13431) | typedef struct { double x; char c; } __Pyx_pad_double;
  type __Pyx_pad_longdouble (line 13432) | typedef struct { long double x; char c; } __Pyx_pad_longdouble;
  type __Pyx_pad_void_p (line 13433) | typedef struct { void *x; char c; } __Pyx_pad_void_p;
  type __Pyx_pad_longlong (line 13435) | typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
  function __Pyx_BufFmt_TypeCharToPadding (line 13437) | static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int ...
  function __Pyx_BufFmt_TypeCharToGroup (line 13455) | static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
  function __Pyx_BufFmt_RaiseExpected (line 13476) | static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
  function __Pyx_BufFmt_ProcessTypeChunk (line 13500) | static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
  function PyObject (line 13602) | static PyObject *
  function CYTHON_INLINE (line 13783) | static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
  function __Pyx_ZeroBuffer (line 13788) | static void __Pyx_ZeroBuffer(Py_buffer* buf) {
  function __Pyx__GetBufferAndValidate (line 13795) | static int __Pyx__GetBufferAndValidate(
  function PyTypeObject (line 13830) | static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
  function PyObject (line 13870) | static PyObject *
  function __Pyx_CyFunction_set_doc (line 13890) | static int
  function PyObject (line 13902) | static PyObject *
  function __Pyx_CyFunction_set_name (line 13917) | static int
  function PyObject (line 13937) | static PyObject *
  function __Pyx_CyFunction_set_qualname (line 13943) | static int
  function PyObject (line 13963) | static PyObject *
  function PyObject (line 13973) | static PyObject *
  function __Pyx_CyFunction_set_dict (line 13984) | static int
  function PyObject (line 14004) | static PyObject *
  function PyObject (line 14010) | static PyObject *
  function PyObject (line 14016) | static PyObject *
  function __Pyx_CyFunction_init_defaults (line 14023) | static int
  function __Pyx_CyFunction_set_defaults (line 14045) | static int
  function PyObject (line 14061) | static PyObject *
  function __Pyx_CyFunction_set_kwdefaults (line 14075) | static int
  function PyObject (line 14091) | static PyObject *
  function __Pyx_CyFunction_set_annotations (line 14105) | static int
  function PyObject (line 14121) | static PyObject *
  function PyObject (line 14157) | static PyObject *
  function PyObject (line 14175) | static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *m...
  function __Pyx_CyFunction_clear (line 14207) | static int
  function __Pyx__CyFunction_dealloc (line 14232) | static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
  function __Pyx_CyFunction_dealloc (line 14239) | static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
  function __Pyx_CyFunction_traverse (line 14244) | static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitpro...
  function PyObject (line 14265) | static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *ob...
  function PyObject (line 14281) | static PyObject*
  function PyObject (line 14292) | static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *...
  function CYTHON_INLINE (line 14346) | static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyO...
  function PyObject (line 14349) | static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject ...
  function __pyx_CyFunction_init (line 14435) | static int __pyx_CyFunction_init(void) {
  function CYTHON_INLINE (line 14442) | static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func,...
  function CYTHON_INLINE (line 14451) | static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *fu...
  function CYTHON_INLINE (line 14456) | static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *f...
  function CYTHON_INLINE (line 14461) | static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *...
  function __Pyx_RaiseBufferFallbackError (line 14468) | static void __Pyx_RaiseBufferFallbackError(void) {
  function CYTHON_INLINE (line 14474) | static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ss...
  function __Pyx_RaiseBufferIndexError (line 14482) | static void __Pyx_RaiseBufferIndexError(int axis) {
  function CYTHON_INLINE (line 14488) | static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expec...
  function CYTHON_INLINE (line 14494) | static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t inde...
  function CYTHON_INLINE (line 14501) | static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
  function _PyErr_StackItem (line 14507) | static _PyErr_StackItem *
  function CYTHON_INLINE (line 14522) | static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, Py...
  function CYTHON_INLINE (line 14537) | static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, P...
  function __Pyx_PyErr_ExceptionMatchesTuple (line 14563) | static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObjec...
  function CYTHON_INLINE (line 14576) | static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadSta...
  function __Pyx_GetException (line 14590) | static int __Pyx_GetException(PyObject **type, PyObject **value, PyObjec...
  function PyObject (line 14662) | static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, P...
  function CYTHON_INLINE (line 14673) | static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObj...
  function PyObject (line 14702) | static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* ...
  function __Pyx_setup_reduce_is_named (line 14711) | static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
  function __Pyx_setup_reduce (line 14727) | static int __Pyx_setup_reduce(PyObject* type_obj) {
  function PyTypeObject (line 14789) | static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *modu...
  function PyObject (line 14848) | static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int l...
  function __Pyx_CLineForTraceback (line 14914) | static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) {
  function __pyx_bisect_code_objects (line 14955) | static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries...
  function PyCodeObject (line 14976) | static PyCodeObject *__pyx_find_code_object(int code_line) {
  function __pyx_insert_code_object (line 14990) | static void __pyx_insert_code_object(int code_line, PyCodeObject* code_o...
  function PyCodeObject (line 15038) | static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
  function __Pyx_AddTraceback (line 15090) | static void __Pyx_AddTraceback(const char *funcname, int c_line,
  function __Pyx_GetBuffer (line 15120) | static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
  function __Pyx_ReleaseBuffer (line 15126) | static void __Pyx_ReleaseBuffer(Py_buffer *view) {
  function CYTHON_INLINE (line 15142) | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
  function CYTHON_INLINE (line 15195) | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_siz(siz value) {
  function CYTHON_INLINE (line 15226) | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t ...
  function CYTHON_INLINE (line 15259) | static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_pa...
  function CYTHON_INLINE (line 15263) | static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_pa...
  function CYTHON_INLINE (line 15268) | static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_pa...
  function CYTHON_INLINE (line 15279) | static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx...
  function CYTHON_INLINE (line 15282) | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_flo...
  function CYTHON_INLINE (line 15288) | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_fl...
  function CYTHON_INLINE (line 15294) | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_fl...
  function CYTHON_INLINE (line 15301) | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_fl...
  function CYTHON_INLINE (line 15321) | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_fl...
  function CYTHON_INLINE (line 15332) | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_flo...
  function CYTHON_INLINE (line 15338) | static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
  function CYTHON_INLINE (line 15341) | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_fl...
  function CYTHON_INLINE (line 15348) | static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
  function CYTHON_INLINE (line 15355) | static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_flo...
  function CYTHON_INLINE (line 15414) | static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_...
  function CYTHON_INLINE (line 15418) | static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_...
  function CYTHON_INLINE (line 15423) | static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_...
  function CYTHON_INLINE (line 15434) | static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __p...
  function CYTHON_INLINE (line 15437) | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_d...
  function CYTHON_INLINE (line 15443) | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_...
  function CYTHON_INLINE (line 15449) | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_...
  function CYTHON_INLINE (line 15456) | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_...
  function CYTHON_INLINE (line 15476) | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_...
  function CYTHON_INLINE (line 15487) | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_d...
  function CYTHON_INLINE (line 15493) | static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
  function CYTHON_INLINE (line 15496) | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_...
  function CYTHON_INLINE (line 15503) | static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
  function CYTHON_INLINE (line 15510) | static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_d...
  function CYTHON_INLINE (line 15567) | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
  function CYTHON_INLINE (line 15598) | static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY...
  function __Pyx_InBases (line 16386) | static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
  function CYTHON_INLINE (line 16394) | static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *...
  function __Pyx_inner_PyErr_GivenExceptionMatches2 (line 16410) | static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObj...
  function CYTHON_INLINE (line 16432) | static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObje...
  function __Pyx_PyErr_GivenExceptionMatchesTuple (line 16440) | static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, Py...
  function CYTHON_INLINE (line 16461) | static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err...
  function CYTHON_INLINE (line 16473) | static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *er...
  function __Pyx_check_binary_version (line 16485) | static int __Pyx_check_binary_version(void) {
  function __Pyx_InitStrings (line 16501) | static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
  function CYTHON_INLINE (line 16533) | static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_...
  function CYTHON_INLINE (line 16536) | static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
  function CYTHON_INLINE (line 16563) | static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObjec...
  function CYTHON_INLINE (line 16605) | static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
  function CYTHON_INLINE (line 16610) | static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
  function PyObject (line 16617) | static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* resul...
  function CYTHON_INLINE (line 16686) | static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  function CYTHON_INLINE (line 16748) | static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
  function CYTHON_INLINE (line 16751) | static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {

FILE: PythonAPI/pysobatools/cocoeval.py
  class COCOeval (line 10) | class COCOeval:
    method __init__ (line 60) | def __init__(self, cocoGt=None, cocoDt=None, iouType='segm'):
    method _prepare (line 84) | def _prepare(self):
    method _prepare_asso (line 121) | def _prepare_asso(self):
    method evaluate (line 159) | def evaluate(self):
    method evaluate_asso (line 201) | def evaluate_asso(self):
    method computeIoU (line 243) | def computeIoU(self, imgId, catId):
    method computeOks (line 272) | def computeOks(self, imgId, catId):
    method evaluateImg (line 318) | def evaluateImg(self, imgId, catId, aRng, maxDet):
    method accumulate (line 400) | def accumulate(self, p = None):
    method summarize (line 507) | def summarize(self):
    method __str__ (line 580) | def __str__(self):
  class Params (line 583) | class Params:
    method setDetParams (line 587) | def setDetParams(self):
    method setKpParams (line 598) | def setKpParams(self):
    method __init__ (line 610) | def __init__(self, iouType='segm'):

FILE: PythonAPI/pysobatools/mask.py
  function encode (line 80) | def encode(bimask):
  function decode (line 87) | def decode(rleObjs):
  function area (line 93) | def area(rleObjs):
  function toBbox (line 99) | def toBbox(rleObjs):

FILE: PythonAPI/pysobatools/soba.py
  function _isArrayLike (line 66) | def _isArrayLike(obj):
  class SOBA (line 70) | class SOBA:
    method __init__ (line 71) | def __init__(self, annotation_file=None):
    method createIndex (line 92) | def createIndex(self):
    method info (line 144) | def info(self):
    method getAssoAnnIds (line 152) | def getAssoAnnIds(self, imgIds=[], catIds=[], areaRng=[], iscrowd=None):
    method getAnnIds (line 180) | def getAnnIds(self, imgIds=[], catIds=[], areaRng=[], iscrowd=None):
    method getAssoIds (line 208) | def getAssoIds(self, catNms=[], supNms=[], catIds=[]):
    method getCatIds (line 230) | def getCatIds(self, catNms=[], supNms=[], catIds=[]):
    method getImgIds (line 252) | def getImgIds(self, imgIds=[], catIds=[]):
    method loadAnns (line 273) | def loadAnns(self, ids=[]):
    method loadAssoAnns (line 284) | def loadAssoAnns(self, ids=[]):
    method loadCats (line 290) | def loadCats(self, ids=[]):
    method loadAsso (line 301) | def loadAsso(self, ids=[]):
    method loadImgs (line 307) | def loadImgs(self, ids=[]):
    method showAnns (line 318) | def showAnns(self, anns):
    method loadRes (line 382) | def loadRes(self, resFile):
    method loadRes_asso (line 443) | def loadRes_asso(self, resFile):
    method download (line 504) | def download(self, tarDir = None, imgIds = [] ):
    method loadNumpyAnnotations (line 528) | def loadNumpyAnnotations(self, data):
    method annToRLE (line 551) | def annToRLE(self, ann):
    method annToMask (line 572) | def annToMask(self, ann):

FILE: PythonAPI/pysobatools/sobaeval.py
  class SOAPeval (line 10) | class SOAPeval:
    method __init__ (line 60) | def __init__(self, isdGt=None, isdDt=None, isdRel = None,iouType='segm'):
    method _prepare (line 87) | def _prepare(self):
    method _prepare_asso (line 124) | def _prepare_asso(self):
    method evaluate (line 162) | def evaluate(self):
    method evaluate_asso (line 204) | def evaluate_asso(self):
    method computeIoU (line 248) | def computeIoU(self, imgId, catId):
    method computeOks (line 277) | def computeOks(self, imgId, catId):
    method evaluateImg (line 320) | def evaluateImg(self, imgId, catId, aRng, maxDet):
    method accumulate (line 458) | def accumulate(self, p = None):
    method summarize (line 565) | def summarize(self):
    method __str__ (line 638) | def __str__(self):
  class Params (line 641) | class Params:
    method setDetParams (line 645) | def setDetParams(self):
    method setKpParams (line 656) | def setKpParams(self):
    method __init__ (line 668) | def __init__(self, iouType='segm'):

FILE: datasets/prepare_panoptic_fpn.py
  function _process_panoptic_to_semantic (line 18) | def _process_panoptic_to_semantic(input_panoptic, output_semantic, segme...
  function separate_coco_semantic_from_panoptic (line 29) | def separate_coco_semantic_from_panoptic(panoptic_json, panoptic_root, s...
  function link_val100 (line 98) | def link_val100(dir_full, dir_100):

FILE: demo/demo.py
  function setup_cfg (line 20) | def setup_cfg(args):
  function get_parser (line 33) | def get_parser():

FILE: demo/predictor.py
  class VisualizationDemo (line 15) | class VisualizationDemo(object):
    method __init__ (line 16) | def __init__(self, cfg, instance_mode=ColorMode.IMAGE, parallel=False):
    method run_on_image (line 37) | def run_on_image(self, image):
    method _frame_from_video (line 68) | def _frame_from_video(self, video):
    method run_on_video (line 76) | def run_on_video(self, video):
  class AsyncPredictor (line 132) | class AsyncPredictor:
    class _StopToken (line 139) | class _StopToken:
    class _PredictWorker (line 142) | class _PredictWorker(mp.Process):
      method __init__ (line 143) | def __init__(self, cfg, task_queue, result_queue):
      method run (line 149) | def run(self):
    method __init__ (line 160) | def __init__(self, cfg, num_gpus: int = 1):
    method put (line 187) | def put(self, image):
    method get (line 191) | def get(self):
    method __len__ (line 207) | def __len__(self):
    method __call__ (line 210) | def __call__(self, image):
    method shutdown (line 214) | def shutdown(self):
    method default_buffer_size (line 219) | def default_buffer_size(self):

FILE: detectron2/checkpoint/c2_model_loading.py
  function convert_basic_c2_names (line 12) | def convert_basic_c2_names(original_keys):
  function convert_c2_detectron_names (line 68) | def convert_c2_detectron_names(weights):
  function align_and_update_state_dicts (line 211) | def align_and_update_state_dicts(model_state_dict, ckpt_state_dict, c2_c...

FILE: detectron2/checkpoint/catalog.py
  class ModelCatalog (line 6) | class ModelCatalog(object):
    method get (line 55) | def get(name):
    method _get_c2_imagenet_pretrained (line 63) | def _get_c2_imagenet_pretrained(name):
    method _get_c2_detectron_baseline (line 71) | def _get_c2_detectron_baseline(name):
  class ModelCatalogHandler (line 92) | class ModelCatalogHandler(PathHandler):
    method _get_supported_prefixes (line 99) | def _get_supported_prefixes(self):
    method _get_local_path (line 102) | def _get_local_path(self, path):
    method _open (line 108) | def _open(self, path, mode="r", **kwargs):
  class Detectron2Handler (line 112) | class Detectron2Handler(PathHandler):
    method _get_supported_prefixes (line 120) | def _get_supported_prefixes(self):
    method _get_local_path (line 123) | def _get_local_path(self, path):
    method _open (line 127) | def _open(self, path, mode="r", **kwargs):

FILE: detectron2/checkpoint/detection_checkpoint.py
  class DetectionCheckpointer (line 11) | class DetectionCheckpointer(Checkpointer):
    method __init__ (line 17) | def __init__(self, model, save_dir="", *, save_to_disk=None, **checkpo...
    method _load_file (line 26) | def _load_file(self, filename):
    method _load_model (line 47) | def _load_model(self, checkpoint):

FILE: detectron2/checkpoint/model_zoo.py
  class ModelCatalog (line 6) | class ModelCatalog(object):
    method get (line 55) | def get(name):
    method _get_c2_imagenet_pretrained (line 63) | def _get_c2_imagenet_pretrained(name):
    method _get_c2_detectron_baseline (line 71) | def _get_c2_detectron_baseline(name):
  class ModelCatalogHandler (line 92) | class ModelCatalogHandler(PathHandler):
    method _get_supported_prefixes (line 99) | def _get_supported_prefixes(self):
    method _get_local_path (line 102) | def _get_local_path(self, path):
    method _open (line 108) | def _open(self, path, mode="r"):
  class Detectron2Handler (line 112) | class Detectron2Handler(PathHandler):
    method _get_supported_prefixes (line 120) | def _get_supported_prefixes(self):
    method _get_local_path (line 123) | def _get_local_path(self, path):
    method _open (line 127) | def _open(self, path, mode="r"):

FILE: detectron2/config/compat.py
  function upgrade_config (line 33) | def upgrade_config(cfg: CN, to_version: Optional[int] = None) -> CN:
  function downgrade_config (line 55) | def downgrade_config(cfg: CN, to_version: int) -> CN:
  function guess_version (line 82) | def guess_version(cfg: CN, filename: str) -> int:
  function _rename (line 116) | def _rename(cfg: CN, old: str, new: str) -> None:
  class _RenameConverter (line 146) | class _RenameConverter:
    method upgrade (line 154) | def upgrade(cls, cfg: CN) -> None:
    method downgrade (line 159) | def downgrade(cls, cfg: CN) -> None:
  class ConverterV1 (line 164) | class ConverterV1(_RenameConverter):
  class ConverterV2 (line 168) | class ConverterV2(_RenameConverter):
    method upgrade (line 204) | def upgrade(cls, cfg: CN) -> None:
    method downgrade (line 222) | def downgrade(cls, cfg: CN) -> None:

FILE: detectron2/config/config.py
  class CfgNode (line 8) | class CfgNode(_CfgNode):
    method merge_from_file (line 22) | def merge_from_file(self, cfg_filename: str, allow_unsafe: bool = True...
  function get_cfg (line 68) | def get_cfg() -> CfgNode:
  function set_global_cfg (line 80) | def set_global_cfg(cfg: CfgNode) -> None:

FILE: detectron2/data/build.py
  function filter_images_with_only_crowd_annotations (line 37) | def filter_images_with_only_crowd_annotations(dataset_dicts):
  function filter_images_with_few_keypoints (line 68) | def filter_images_with_few_keypoints(dataset_dicts, min_keypoints_per_im...
  function load_proposals_into_dataset (line 102) | def load_proposals_into_dataset(dataset_dicts, proposal_file):
  function _quantize (line 151) | def _quantize(x, bin_edges):
  function print_instances_class_histogram (line 158) | def print_instances_class_histogram(dataset_dicts, class_names):
  function build_batch_data_sampler (line 203) | def build_batch_data_sampler(
  function get_detection_dataset_dicts (line 242) | def get_detection_dataset_dicts(
  function build_detection_train_loader (line 287) | def build_detection_train_loader(cfg, mapper=None):
  function build_detection_test_loader (line 366) | def build_detection_test_loader(cfg, dataset_name, mapper=None):
  function trivial_batch_collator (line 412) | def trivial_batch_collator(batch):
  function worker_init_reset_seed (line 419) | def worker_init_reset_seed(worker_id):

FILE: detectron2/data/catalog.py
  class DatasetCatalog (line 12) | class DatasetCatalog(object):
    method register (line 31) | def register(name, func):
    method get (line 40) | def get(name):
    method list (line 61) | def list() -> List[str]:
    method clear (line 71) | def clear():
  class Metadata (line 78) | class Metadata(types.SimpleNamespace):
    method __getattr__ (line 104) | def __getattr__(self, key):
    method __setattr__ (line 119) | def __setattr__(self, key, val):
    method as_dict (line 138) | def as_dict(self):
    method set (line 145) | def set(self, **kwargs):
    method get (line 153) | def get(self, key, default=None):
  class MetadataCatalog (line 164) | class MetadataCatalog:
    method get (line 179) | def get(name):

FILE: detectron2/data/common.py
  class MapDataset (line 12) | class MapDataset(data.Dataset):
    method __init__ (line 24) | def __init__(self, dataset, map_func):
    method __len__ (line 31) | def __len__(self):
    method __getitem__ (line 34) | def __getitem__(self, idx):
  class DatasetFromList (line 58) | class DatasetFromList(data.Dataset):
    method __init__ (line 63) | def __init__(self, lst: list, copy: bool = True):
    method __len__ (line 74) | def __len__(self):
    method __getitem__ (line 77) | def __getitem__(self, idx):

FILE: detectron2/data/dataset_mapper.py
  class DatasetMapper (line 18) | class DatasetMapper:
    method __init__ (line 32) | def __init__(self, cfg, is_train=True):
    method __call__ (line 62) | def __call__(self, dataset_dict):

FILE: detectron2/data/datasets/builtin.py
  function register_all_coco (line 102) | def register_all_coco(root="datasets"):
  function register_all_lvis (line 144) | def register_all_lvis(root="datasets"):
  function register_all_cityscapes (line 166) | def register_all_cityscapes(root="datasets"):
  function register_all_pascal_voc (line 193) | def register_all_pascal_voc(root="datasets"):

FILE: detectron2/data/datasets/builtin_meta.py
  function _get_coco_instances_meta (line 191) | def _get_coco_instances_meta():
  function _get_coco_panoptic_separated_meta (line 206) | def _get_coco_panoptic_separated_meta():
  function _get_builtin_metadata (line 239) | def _get_builtin_metadata(dataset_name):

FILE: detectron2/data/datasets/cityscapes.py
  function load_cityscapes_instances (line 25) | def load_cityscapes_instances(image_dir, gt_dir, from_json=True, to_poly...
  function load_cityscapes_semantic (line 81) | def load_cityscapes_semantic(image_dir, gt_dir):
  function cityscapes_files_to_dict (line 117) | def cityscapes_files_to_dict(files, from_json, to_polygons):

FILE: detectron2/data/datasets/coco.py
  function load_coco_json (line 24) | def load_coco_json(json_file, image_root, dataset_name=None):
  function load_sem_seg (line 255) | def load_sem_seg(gt_root, image_root, gt_ext="png", image_ext="jpg"):

FILE: detectron2/data/datasets/lvis.py
  function register_lvis_instances (line 22) | def register_lvis_instances(name, metadata, json_file, image_root):
  function load_lvis_json (line 38) | def load_lvis_json(json_file, image_root, dataset_name=None):
  function get_lvis_instances_meta (line 147) | def get_lvis_instances_meta(dataset_name):
  function _get_lvis_instances_meta_v0_5 (line 165) | def _get_lvis_instances_meta_v0_5():

FILE: detectron2/data/datasets/pascal_voc.py
  function load_voc_instances (line 25) | def load_voc_instances(dirname: str, split: str):
  function register_pascal_voc (line 74) | def register_pascal_voc(name, dirname, split, year):

FILE: detectron2/data/datasets/register_coco.py
  function register_coco_instances (line 14) | def register_coco_instances(name, metadata, json_file, image_root):
  function register_coco_panoptic_separated (line 41) | def register_coco_panoptic_separated(
  function merge_to_panoptic (line 102) | def merge_to_panoptic(detection_dicts, sem_seg_dicts):

FILE: detectron2/data/datasets/register_soba.py
  function register_soba_instances (line 14) | def register_soba_instances(name, metadata, json_file, image_root):
  function register_soba_panoptic_separated (line 41) | def register_soba_panoptic_separated(
  function merge_to_panoptic (line 102) | def merge_to_panoptic(detection_dicts, sem_seg_dicts):

FILE: detectron2/data/datasets/soba.py
  function load_soba_json (line 24) | def load_soba_json(json_file, image_root, dataset_name=None):
  function load_sem_seg (line 255) | def load_sem_seg(gt_root, image_root, gt_ext="png", image_ext="jpg"):

FILE: detectron2/data/detection_utils.py
  class SizeMismatchError (line 29) | class SizeMismatchError(ValueError):
  function read_image (line 35) | def read_image(file_name, format=None):
  function check_image_size (line 65) | def check_image_size(dataset_dict, image):
  function transform_proposals (line 78) | def transform_proposals(dataset_dict, image_shape, transforms, min_box_s...
  function transform_instance_annotations (line 120) | def transform_instance_annotations(
  function transform_keypoint_annotations (line 187) | def transform_keypoint_annotations(keypoints, transforms, image_size, ke...
  function annotations_to_instances (line 221) | def annotations_to_instances(annos, image_size, mask_format="polygon"):
  function annotations_to_instances_rotated (line 292) | def annotations_to_instances_rotated(annos, image_size):
  function filter_empty_instances (line 321) | def filter_empty_instances(instances, by_box=True, by_mask=True):
  function create_keypoint_hflip_indices (line 350) | def create_keypoint_hflip_indices(dataset_names):
  function gen_crop_transform_with_instance (line 373) | def gen_crop_transform_with_instance(crop_size, image_size, instance):
  function check_metadata_consistency (line 397) | def check_metadata_consistency(key, dataset_names):
  function build_transform_gen (line 426) | def build_transform_gen(cfg, is_train):

FILE: detectron2/data/samplers/distributed_sampler.py
  class TrainingSampler (line 12) | class TrainingSampler(Sampler):
    method __init__ (line 24) | def __init__(self, size: int, shuffle: bool = True, seed: Optional[int...
    method __iter__ (line 43) | def __iter__(self):
    method _infinite_indices (line 47) | def _infinite_indices(self):
  class RepeatFactorTrainingSampler (line 57) | class RepeatFactorTrainingSampler(Sampler):
    method __init__ (line 69) | def __init__(self, dataset_dicts, repeat_thresh, shuffle=True, seed=No...
    method _get_repeat_factors (line 93) | def _get_repeat_factors(self, dataset_dicts, repeat_thresh):
    method _get_epoch_indices (line 131) | def _get_epoch_indices(self, generator):
    method __iter__ (line 154) | def __iter__(self):
    method _infinite_indices (line 158) | def _infinite_indices(self):
  class InferenceSampler (line 172) | class InferenceSampler(Sampler):
    method __init__ (line 180) | def __init__(self, size: int):
    method __iter__ (line 195) | def __iter__(self):
    method __len__ (line 198) | def __len__(self):

FILE: detectron2/data/samplers/grouped_batch_sampler.py
  class GroupedBatchSampler (line 6) | class GroupedBatchSampler(BatchSampler):
    method __init__ (line 22) | def __init__(self, sampler, group_ids, batch_size):
    method __iter__ (line 39) | def __iter__(self):

FILE: detectron2/data/transforms/transform.py
  class ExtentTransform (line 12) | class ExtentTransform(Transform):
    method __init__ (line 22) | def __init__(self, src_rect, output_size, interp=Image.LINEAR, fill=0):
    method apply_image (line 33) | def apply_image(self, img, interp=None):
    method apply_coords (line 44) | def apply_coords(self, coords):
    method apply_segmentation (line 58) | def apply_segmentation(self, segmentation):
  class ResizeTransform (line 63) | class ResizeTransform(Transform):
    method __init__ (line 68) | def __init__(self, h, w, new_h, new_w, interp):
    method apply_image (line 79) | def apply_image(self, img, interp=None):
    method apply_coords (line 87) | def apply_coords(self, coords):
    method apply_segmentation (line 92) | def apply_segmentation(self, segmentation):
  function HFlip_rotated_box (line 97) | def HFlip_rotated_box(transform, rotated_boxes):
  function Resize_rotated_box (line 113) | def Resize_rotated_box(transform, rotated_boxes):

FILE: detectron2/data/transforms/transform_gen.py
  function check_dtype (line 37) | def check_dtype(img):
  class TransformGen (line 49) | class TransformGen(metaclass=ABCMeta):
    method _init (line 65) | def _init(self, params=None):
    method get_transform (line 72) | def get_transform(self, img):
    method _rand_range (line 75) | def _rand_range(self, low=1.0, high=None, size=None):
    method __repr__ (line 85) | def __repr__(self):
  class RandomFlip (line 118) | class RandomFlip(TransformGen):
    method __init__ (line 125) | def __init__(self, prob=0.5):
    method get_transform (line 140) | def get_transform(self, img):
  class Resize (line 149) | class Resize(TransformGen):
    method __init__ (line 152) | def __init__(self, shape, interp=Image.BILINEAR):
    method get_transform (line 163) | def get_transform(self, img):
  class ResizeShortestEdge (line 169) | class ResizeShortestEdge(TransformGen):
    method __init__ (line 175) | def __init__(
    method get_transform (line 194) | def get_transform(self, img):
  class RandomCrop (line 216) | class RandomCrop(TransformGen):
    method __init__ (line 221) | def __init__(self, crop_type: str, crop_size):
    method get_transform (line 233) | def get_transform(self, img):
    method get_crop_size (line 241) | def get_crop_size(self, image_size):
  class RandomExtent (line 263) | class RandomExtent(TransformGen):
    method __init__ (line 272) | def __init__(self, scale_range, shift_range):
    method get_transform (line 285) | def get_transform(self, img):
  class RandomContrast (line 308) | class RandomContrast(TransformGen):
    method __init__ (line 320) | def __init__(self, intensity_min, intensity_max):
    method get_transform (line 329) | def get_transform(self, img):
  class RandomBrightness (line 334) | class RandomBrightness(TransformGen):
    method __init__ (line 346) | def __init__(self, intensity_min, intensity_max):
    method get_transform (line 355) | def get_transform(self, img):
  class RandomSaturation (line 360) | class RandomSaturation(TransformGen):
    method __init__ (line 372) | def __init__(self, intensity_min, intensity_max):
    method get_transform (line 381) | def get_transform(self, img):
  class RandomLighting (line 388) | class RandomLighting(TransformGen):
    method __init__ (line 396) | def __init__(self, scale):
    method get_transform (line 408) | def get_transform(self, img):
  function apply_transform_gens (line 416) | def apply_transform_gens(transform_gens, img):

FILE: detectron2/engine/defaults.py
  function default_argument_parser (line 48) | def default_argument_parser():
  function default_setup (line 83) | def default_setup(cfg, args):
  class DefaultPredictor (line 132) | class DefaultPredictor:
    method __init__ (line 142) | def __init__(self, cfg):
    method __call__ (line 159) | def __call__(self, original_image):
  class DefaultTrainer (line 180) | class DefaultTrainer(SimpleTrainer):
    method __init__ (line 209) | def __init__(self, cfg):
    method resume_or_load (line 242) | def resume_or_load(self, resume=True):
    method build_hooks (line 260) | def build_hooks(self):
    method build_writers (line 306) | def build_writers(self):
    method train (line 322) | def train(self):
    method build_model (line 335) | def build_model(cls, cfg):
    method build_optimizer (line 346) | def build_optimizer(cls, cfg, model):
    method build_lr_scheduler (line 354) | def build_lr_scheduler(cls, cfg, optimizer):
    method build_train_loader (line 358) | def build_train_loader(cls, cfg):
    method build_test_loader (line 366) | def build_test_loader(cls, cfg, dataset_name):
    method build_evaluator (line 374) | def build_evaluator(cls, cfg, dataset_name):
    method test (line 382) | def test(cls, cfg, model, evaluators=None):

FILE: detectron2/engine/hooks.py
  class CallbackHook (line 39) | class CallbackHook(HookBase):
    method __init__ (line 44) | def __init__(self, *, before_train=None, after_train=None, before_step...
    method before_train (line 53) | def before_train(self):
    method after_train (line 57) | def after_train(self):
    method before_step (line 65) | def before_step(self):
    method after_step (line 69) | def after_step(self):
  class IterationTimer (line 74) | class IterationTimer(HookBase):
    method __init__ (line 86) | def __init__(self, warmup_iter=3):
    method before_train (line 95) | def before_train(self):
    method after_train (line 100) | def after_train(self):
    method before_step (line 126) | def before_step(self):
    method after_step (line 130) | def after_step(self):
  class PeriodicWriter (line 143) | class PeriodicWriter(HookBase):
    method __init__ (line 150) | def __init__(self, writers, period=20):
    method after_step (line 159) | def after_step(self):
  class PeriodicCheckpointer (line 167) | class PeriodicCheckpointer(_PeriodicCheckpointer, HookBase):
    method before_train (line 178) | def before_train(self):
    method after_step (line 181) | def after_step(self):
  class LRScheduler (line 186) | class LRScheduler(HookBase):
    method __init__ (line 192) | def __init__(self, optimizer, scheduler):
    method after_step (line 220) | def after_step(self):
  class AutogradProfiler (line 226) | class AutogradProfiler(HookBase):
    method __init__ (line 238) | def __init__(self, enable_predicate, output_dir, *, use_cuda=True):
    method before_step (line 251) | def before_step(self):
    method after_step (line 258) | def after_step(self):
  class EvalHook (line 278) | class EvalHook(HookBase):
    method __init__ (line 285) | def __init__(self, eval_period, eval_function):
    method after_step (line 300) | def after_step(self):
    method after_train (line 326) | def after_train(self):
  class PreciseBN (line 332) | class PreciseBN(HookBase):
    method __init__ (line 342) | def __init__(self, period, model, data_loader, num_iter):
    method after_step (line 371) | def after_step(self):
    method update_stats (line 377) | def update_stats(self):

FILE: detectron2/engine/launch.py
  function _find_free_port (line 12) | def _find_free_port():
  function launch (line 24) | def launch(main_func, num_gpus_per_machine, num_machines=1, machine_rank...
  function _distributed_worker (line 55) | def _distributed_worker(

FILE: detectron2/engine/train_loop.py
  class HookBase (line 16) | class HookBase:
    method before_train (line 51) | def before_train(self):
    method after_train (line 57) | def after_train(self):
    method before_step (line 63) | def before_step(self):
    method after_step (line 69) | def after_step(self):
  class TrainerBase (line 76) | class TrainerBase:
    method __init__ (line 95) | def __init__(self):
    method register_hooks (line 98) | def register_hooks(self, hooks):
    method train (line 116) | def train(self, start_iter: int, max_iter: int):
    method before_train (line 137) | def before_train(self):
    method after_train (line 141) | def after_train(self):
    method before_step (line 145) | def before_step(self):
    method after_step (line 149) | def after_step(self):
    method run_step (line 155) | def run_step(self):
  class SimpleTrainer (line 159) | class SimpleTrainer(TrainerBase):
    method __init__ (line 174) | def __init__(self, model, data_loader, optimizer):
    method run_step (line 197) | def run_step(self):
    method _detect_anomaly (line 233) | def _detect_anomaly(self, losses, loss_dict):
    method _write_metrics (line 241) | def _write_metrics(self, metrics_dict: dict):

FILE: detectron2/evaluation/cityscapes_evaluation.py
  class CityscapesEvaluator (line 16) | class CityscapesEvaluator(DatasetEvaluator):
    method __init__ (line 25) | def __init__(self, dataset_name):
    method reset (line 36) | def reset(self):
    method process (line 48) | def process(self, inputs, outputs):
    method evaluate (line 72) | def evaluate(self):

FILE: detectron2/evaluation/coco_evaluation.py
  class COCOEvaluator (line 27) | class COCOEvaluator(DatasetEvaluator):
    method __init__ (line 33) | def __init__(self, dataset_name, cfg, distributed, output_dir=None):
    method reset (line 61) | def reset(self):
    method _tasks_from_config (line 65) | def _tasks_from_config(self, cfg):
    method process (line 77) | def process(self, inputs, outputs):
    method evaluate (line 130) | def evaluate(self):
    method _eval_predictions (line 160) | def _eval_predictions(self, tasks):
    method _eval_box_proposals (line 225) | def _eval_box_proposals(self):
    method _derive_coco_results (line 284) | def _derive_coco_results(self, coco_eval, iou_type, class_names=None):
  function instances_to_json (line 348) | def instances_to_json(instances, img_id):
  function _evaluate_box_proposals (line 408) | def _evaluate_box_proposals(dataset_predictions, coco_api, thresholds=No...
  function _evaluate_predictions_on_coco (line 517) | def _evaluate_predictions_on_coco(coco_gt, coco_results, iou_type, kpt_o...

FILE: detectron2/evaluation/evaluation/cityscapes_evaluation.py
  class CityscapesEvaluator (line 16) | class CityscapesEvaluator(DatasetEvaluator):
    method __init__ (line 25) | def __init__(self, dataset_name):
    method reset (line 36) | def reset(self):
    method process (line 48) | def process(self, inputs, outputs):
    method evaluate (line 72) | def evaluate(self):

FILE: detectron2/evaluation/evaluation/coco_evaluation.py
  class COCOEvaluator (line 27) | class COCOEvaluator(DatasetEvaluator):
    method __init__ (line 33) | def __init__(self, dataset_name, cfg, distributed, output_dir=None):
    method reset (line 61) | def reset(self):
    method _tasks_from_config (line 65) | def _tasks_from_config(self, cfg):
    method process (line 77) | def process(self, inputs, outputs):
    method evaluate (line 130) | def evaluate(self):
    method _eval_predictions (line 160) | def _eval_predictions(self, tasks):
    method _eval_box_proposals (line 225) | def _eval_box_proposals(self):
    method _derive_coco_results (line 284) | def _derive_coco_results(self, coco_eval, iou_type, class_names=None):
  function instances_to_json (line 348) | def instances_to_json(instances, img_id):
  function _evaluate_box_proposals (line 408) | def _evaluate_box_proposals(dataset_predictions, coco_api, thresholds=No...
  function _evaluate_predictions_on_coco (line 517) | def _evaluate_predictions_on_coco(coco_gt, coco_results, iou_type, kpt_o...

FILE: detectron2/evaluation/evaluation/evaluator.py
  class DatasetEvaluator (line 12) | class DatasetEvaluator:
    method reset (line 23) | def reset(self):
    method process (line 30) | def process(self, input, output):
    method evaluate (line 40) | def evaluate(self):
  class DatasetEvaluators (line 56) | class DatasetEvaluators(DatasetEvaluator):
    method __init__ (line 57) | def __init__(self, evaluators):
    method reset (line 62) | def reset(self):
    method process (line 66) | def process(self, input, output):
    method evaluate (line 70) | def evaluate(self):
  function inference_on_dataset (line 83) | def inference_on_dataset(model, data_loader, evaluator):
  function inference_context (line 150) | def inference_context(model):

FILE: detectron2/evaluation/evaluation/lvis_evaluation.py
  class LVISEvaluator (line 23) | class LVISEvaluator(DatasetEvaluator):
    method __init__ (line 29) | def __init__(self, dataset_name, cfg, distributed, output_dir=None):
    method reset (line 56) | def reset(self):
    method _tasks_from_config (line 60) | def _tasks_from_config(self, cfg):
    method process (line 70) | def process(self, inputs, outputs):
    method evaluate (line 107) | def evaluate(self):
    method _eval_predictions (line 134) | def _eval_predictions(self, tasks):
    method _eval_box_proposals (line 167) | def _eval_box_proposals(self):
  function _evaluate_box_proposals (line 211) | def _evaluate_box_proposals(dataset_predictions, lvis_api, thresholds=No...
  function _evaluate_predictions_on_lvis (line 318) | def _evaluate_predictions_on_lvis(lvis_gt, lvis_results, iou_type, class...

FILE: detectron2/evaluation/evaluation/panoptic_evaluation.py
  class COCOPanopticEvaluator (line 22) | class COCOPanopticEvaluator(DatasetEvaluator):
    method __init__ (line 30) | def __init__(self, dataset_name, output_dir):
    method reset (line 47) | def reset(self):
    method _convert_category_id (line 50) | def _convert_category_id(self, segment_info):
    method process (line 65) | def process(self, inputs, outputs):
    method evaluate (line 86) | def evaluate(self):
  function _print_panoptic_results (line 140) | def _print_panoptic_results(pq_res):

FILE: detectron2/evaluation/evaluation/pascal_voc_evaluation.py
  class PascalVOCDetectionEvaluator (line 19) | class PascalVOCDetectionEvaluator(DatasetEvaluator):
    method __init__ (line 29) | def __init__(self, dataset_name):
    method reset (line 44) | def reset(self):
    method process (line 47) | def process(self, inputs, outputs):
    method evaluate (line 63) | def evaluate(self):
  function parse_rec (line 125) | def parse_rec(filename):
  function voc_ap (line 147) | def voc_ap(rec, prec, use_07_metric=False):
  function voc_eval (line 179) | def voc_eval(detpath, annopath, imagesetfile, classname, ovthresh=0.5, u...

FILE: detectron2/evaluation/evaluation/sem_seg_evaluation.py
  class SemSegEvaluator (line 19) | class SemSegEvaluator(DatasetEvaluator):
    method __init__ (line 24) | def __init__(self, dataset_name, distributed, num_classes, ignore_labe...
    method reset (line 58) | def reset(self):
    method process (line 62) | def process(self, inputs, outputs):
    method evaluate (line 86) | def evaluate(self):
    method encode_json_sem_seg (line 143) | def encode_json_sem_seg(self, sem_seg, image_id):

FILE: detectron2/evaluation/evaluation/testing.py
  function print_csv_format (line 9) | def print_csv_format(results):
  function verify_results (line 27) | def verify_results(cfg, results):
  function flatten_results_dict (line 60) | def flatten_results_dict(results):

FILE: detectron2/evaluation/evaluator.py
  class DatasetEvaluator (line 12) | class DatasetEvaluator:
    method reset (line 23) | def reset(self):
    method process (line 30) | def process(self, input, output):
    method evaluate (line 40) | def evaluate(self):
  class DatasetEvaluators (line 56) | class DatasetEvaluators(DatasetEvaluator):
    method __init__ (line 57) | def __init__(self, evaluators):
    method reset (line 62) | def reset(self):
    method process (line 66) | def process(self, input, output):
    method evaluate (line 70) | def evaluate(self):
  function inference_on_dataset (line 83) | def inference_on_dataset(model, data_loader, evaluator):
  function inference_context (line 150) | def inference_context(model):

FILE: detectron2/evaluation/lvis_evaluation.py
  class LVISEvaluator (line 23) | class LVISEvaluator(DatasetEvaluator):
    method __init__ (line 29) | def __init__(self, dataset_name, cfg, distributed, output_dir=None):
    method reset (line 56) | def reset(self):
    method _tasks_from_config (line 60) | def _tasks_from_config(self, cfg):
    method process (line 70) | def process(self, inputs, outputs):
    method evaluate (line 107) | def evaluate(self):
    method _eval_predictions (line 134) | def _eval_predictions(self, tasks):
    method _eval_box_proposals (line 167) | def _eval_box_proposals(self):
  function _evaluate_box_proposals (line 211) | def _evaluate_box_proposals(dataset_predictions, lvis_api, thresholds=No...
  function _evaluate_predictions_on_lvis (line 318) | def _evaluate_predictions_on_lvis(lvis_gt, lvis_results, iou_type, class...

FILE: detectron2/evaluation/panoptic_evaluation.py
  class COCOPanopticEvaluator (line 22) | class COCOPanopticEvaluator(DatasetEvaluator):
    method __init__ (line 30) | def __init__(self, dataset_name, output_dir):
    method reset (line 47) | def reset(self):
    method _convert_category_id (line 50) | def _convert_category_id(self, segment_info):
    method process (line 65) | def process(self, inputs, outputs):
    method evaluate (line 86) | def evaluate(self):
  function _print_panoptic_results (line 140) | def _print_panoptic_results(pq_res):

FILE: detectron2/evaluation/pascal_voc_evaluation.py
  class PascalVOCDetectionEvaluator (line 19) | class PascalVOCDetectionEvaluator(DatasetEvaluator):
    method __init__ (line 29) | def __init__(self, dataset_name):
    method reset (line 44) | def reset(self):
    method process (line 47) | def process(self, inputs, outputs):
    method evaluate (line 63) | def evaluate(self):
  function parse_rec (line 125) | def parse_rec(filename):
  function voc_ap (line 147) | def voc_ap(rec, prec, use_07_metric=False):
  function voc_eval (line 179) | def voc_eval(detpath, annopath, imagesetfile, classname, ovthresh=0.5, u...

FILE: detectron2/evaluation/rotated_coco_evaluation.py
  class RotatedCOCOeval (line 14) | class RotatedCOCOeval(COCOeval):
    method is_rotated (line 16) | def is_rotated(box_list):
    method boxlist_to_tensor (line 33) | def boxlist_to_tensor(boxlist, output_box_dim):
    method compute_iou_dt_gt (line 56) | def compute_iou_dt_gt(self, dt, gt, is_crowd):
    method computeIoU (line 67) | def computeIoU(self, imgId, catId):
  class RotatedCOCOEvaluator (line 96) | class RotatedCOCOEvaluator(COCOEvaluator):
    method process (line 103) | def process(self, inputs, outputs):
    method instances_to_json (line 123) | def instances_to_json(self, instances, img_id):
    method _eval_predictions (line 147) | def _eval_predictions(self, tasks):
    method _evaluate_predictions_on_coco (line 188) | def _evaluate_predictions_on_coco(self, coco_gt, coco_results):

FILE: detectron2/evaluation/sem_seg_evaluation.py
  class SemSegEvaluator (line 19) | class SemSegEvaluator(DatasetEvaluator):
    method __init__ (line 24) | def __init__(self, dataset_name, distributed, num_classes, ignore_labe...
    method reset (line 58) | def reset(self):
    method process (line 62) | def process(self, inputs, outputs):
    method evaluate (line 86) | def evaluate(self):
    method encode_json_sem_seg (line 143) | def encode_json_sem_seg(self, sem_seg, image_id):

FILE: detectron2/evaluation/soba_evaluation.py
  class SOBAEvaluator (line 27) | class SOBAEvaluator(DatasetEvaluator):
    method __init__ (line 33) | def __init__(self, dataset_name, cfg, distributed, output_dir=None):
    method reset (line 61) | def reset(self):
    method _tasks_from_config (line 65) | def _tasks_from_config(self, cfg):
    method process (line 77) | def process(self, inputs, outputs):
    method evaluate (line 130) | def evaluate(self):
    method _eval_predictions (line 160) | def _eval_predictions(self, tasks):
    method _eval_box_proposals (line 225) | def _eval_box_proposals(self):
    method _derive_soba_results (line 284) | def _derive_soba_results(self, soba_eval, iou_type, class_names=None):
  function instances_to_json (line 348) | def instances_to_json(instances, img_id):
  function _evaluate_box_proposals (line 408) | def _evaluate_box_proposals(dataset_predictions, soba_api, thresholds=No...
  function _evaluate_predictions_on_soba (line 517) | def _evaluate_predictions_on_soba(soba_gt, soba_results, iou_type, kpt_o...

FILE: detectron2/evaluation/testing.py
  function print_csv_format (line 9) | def print_csv_format(results):
  function verify_results (line 27) | def verify_results(cfg, results):
  function flatten_results_dict (line 60) | def flatten_results_dict(results):

FILE: detectron2/export/api.py
  function add_export_config (line 17) | def add_export_config(cfg):
  function export_caffe2_model (line 34) | def export_caffe2_model(cfg, model, inputs):
  class Caffe2Model (line 58) | class Caffe2Model(nn.Module):
    method __init__ (line 59) | def __init__(self, predict_net, init_net):
    method predict_net (line 67) | def predict_net(self):
    method init_net (line 75) | def init_net(self):
    method save_protobuf (line 84) | def save_protobuf(self, output_dir):
    method save_graph (line 102) | def save_graph(self, output_file, inputs=None):
    method load_protobuf (line 123) | def load_protobuf(dir):
    method __call__ (line 143) | def __call__(self, inputs):

FILE: detectron2/export/c10.py
  class Boxes4or5 (line 21) | class Boxes4or5(Boxes):
    method __init__ (line 27) | def __init__(self, tensor):
  class InstancesList (line 35) | class InstancesList(object):
    method __init__ (line 45) | def __init__(self, im_info, indices, extra_fields=None):
    method get_fields (line 55) | def get_fields(self):
    method has (line 69) | def has(self, name):
    method set (line 72) | def set(self, name, value):
    method __setattr__ (line 80) | def __setattr__(self, name, val):
    method __getattr__ (line 86) | def __getattr__(self, name):
    method __len__ (line 91) | def __len__(self):
    method flatten (line 94) | def flatten(self):
    method to_d2_instances_list (line 104) | def to_d2_instances_list(instances_list):
  class Caffe2Compatible (line 144) | class Caffe2Compatible(object):
    method _get_tensor_mode (line 145) | def _get_tensor_mode(self):
    method _set_tensor_mode (line 148) | def _set_tensor_mode(self, v):
  class Caffe2RPN (line 157) | class Caffe2RPN(Caffe2Compatible, rpn.RPN):
    method forward (line 158) | def forward(self, images, features, gt_instances=None):
    method c2_postprocess (line 248) | def c2_postprocess(im_info, rpn_rois, rpn_roi_probs, tensor_mode):
  class Caffe2ROIPooler (line 264) | class Caffe2ROIPooler(Caffe2Compatible, poolers.ROIPooler):
    method c2_preprocess (line 266) | def c2_preprocess(box_lists):
    method forward (line 276) | def forward(self, x, box_lists):
  class Caffe2FastRCNNOutputsInference (line 331) | class Caffe2FastRCNNOutputsInference:
    method __init__ (line 332) | def __init__(self, tensor_mode):
    method __call__ (line 335) | def __call__(self, fastrcnn_outputs, score_thresh, nms_thresh, topk_pe...
  class Caffe2MaskRCNNInference (line 449) | class Caffe2MaskRCNNInference:
    method __call__ (line 450) | def __call__(self, pred_mask_logits, pred_instances):
  class Caffe2KeypointRCNNInference (line 461) | class Caffe2KeypointRCNNInference:
    method __init__ (line 462) | def __init__(self, use_heatmap_max_keypoint):
    method __call__ (line 465) | def __call__(self, pred_keypoint_logits, pred_instances):

FILE: detectron2/export/caffe2_export.py
  function _export_via_onnx (line 33) | def _export_via_onnx(model, inputs):
  function _op_stats (line 66) | def _op_stats(net_def):
  function _assign_device_option (line 75) | def _assign_device_option(
  function export_caffe2_detection_model (line 121) | def export_caffe2_detection_model(model: torch.nn.Module, tensor_inputs:...
  function run_and_save_graph (line 162) | def run_and_save_graph(predict_net, init_net, tensor_inputs, graph_save_...

FILE: detectron2/export/caffe2_inference.py
  class ProtobufModel (line 16) | class ProtobufModel(torch.nn.Module):
    method __init__ (line 23) | def __init__(self, predict_net, init_net):
    method forward (line 40) | def forward(self, inputs_dict):
  class ProtobufDetectionModel (line 68) | class ProtobufDetectionModel(torch.nn.Module):
    method __init__ (line 74) | def __init__(self, predict_net, init_net, *, convert_outputs=None):
    method _infer_output_devices (line 94) | def _infer_output_devices(self, inputs_dict):
    method _convert_inputs (line 112) | def _convert_inputs(self, batched_inputs):
    method forward (line 119) | def forward(self, batched_inputs):

FILE: detectron2/export/caffe2_modeling.py
  function assemble_rcnn_outputs_by_name (line 29) | def assemble_rcnn_outputs_by_name(image_sizes, tensor_outputs, force_mas...
  function _cast_to_f32 (line 94) | def _cast_to_f32(f64):
  function set_caffe2_compatible_tensor_mode (line 98) | def set_caffe2_compatible_tensor_mode(model, enable=True):
  function convert_batched_inputs_to_c2_format (line 106) | def convert_batched_inputs_to_c2_format(batched_inputs, size_divisibilit...
  class Caffe2MetaArch (line 134) | class Caffe2MetaArch(Caffe2Compatible, torch.nn.Module):
    method __init__ (line 141) | def __init__(self, cfg, torch_model):
    method get_caffe2_inputs (line 153) | def get_caffe2_inputs(self, batched_inputs):
    method encode_additional_info (line 177) | def encode_additional_info(self, predict_net, init_net):
    method forward (line 183) | def forward(self, inputs):
    method _caffe2_preprocess_image (line 198) | def _caffe2_preprocess_image(self, inputs):
    method get_outputs_converter (line 215) | def get_outputs_converter(predict_net, init_net):
  class Caffe2GeneralizedRCNN (line 243) | class Caffe2GeneralizedRCNN(Caffe2MetaArch):
    method __init__ (line 244) | def __init__(self, cfg, torch_model):
    method encode_additional_info (line 251) | def encode_additional_info(self, predict_net, init_net):
    method forward (line 260) | def forward(self, inputs):
    method get_outputs_converter (line 271) | def get_outputs_converter(predict_net, init_net):
  class Caffe2PanopticFPN (line 280) | class Caffe2PanopticFPN(Caffe2MetaArch):
    method __init__ (line 281) | def __init__(self, cfg, torch_model):
    method forward (line 289) | def forward(self, inputs):
    method encode_additional_info (line 304) | def encode_additional_info(self, predict_net, init_net):
    method get_outputs_converter (line 334) | def get_outputs_converter(predict_net, init_net):
  class Caffe2RetinaNet (line 375) | class Caffe2RetinaNet(Caffe2MetaArch):
    method __init__ (line 376) | def __init__(self, cfg, torch_model):
    method forward (line 381) | def forward(self, inputs):
    method encode_additional_info (line 402) | def encode_additional_info(self, predict_net, init_net):
    method _encode_anchor_generator_cfg (line 433) | def _encode_anchor_generator_cfg(self, predict_net):
    method get_outputs_converter (line 443) | def get_outputs_converter(predict_net, init_net):

FILE: detectron2/export/patcher.py
  class GenericMixin (line 22) | class GenericMixin(object):
  class Caffe2CompatibleConverter (line 26) | class Caffe2CompatibleConverter(object):
    method __init__ (line 32) | def __init__(self, replaceCls):
    method create_from (line 35) | def create_from(self, module):
  function patch (line 57) | def patch(model, target, updater, *args, **kwargs):
  function patch_generalized_rcnn (line 70) | def patch_generalized_rcnn(model):
  function mock_fastrcnn_outputs_inference (line 79) | def mock_fastrcnn_outputs_inference(tensor_mode, check=True):
  function mock_mask_rcnn_inference (line 92) | def mock_mask_rcnn_inference(tensor_mode, patched_module, check=True):
  function mock_keypoint_rcnn_inference (line 102) | def mock_keypoint_rcnn_inference(tensor_mode, patched_module, use_heatma...
  class ROIHeadsPatcher (line 112) | class ROIHeadsPatcher:
    method __init__ (line 113) | def __init__(self, cfg, heads):
    method mock_roi_heads (line 119) | def mock_roi_heads(self, tensor_mode=True):

FILE: detectron2/export/shared.py
  function to_device (line 25) | def to_device(t, device_str):
  function BilinearInterpolation (line 48) | def BilinearInterpolation(tensor_in, up_scale):
  function onnx_compatibale_interpolate (line 82) | def onnx_compatibale_interpolate(
  function mock_torch_nn_functional_interpolate (line 116) | def mock_torch_nn_functional_interpolate():
  class ScopedWS (line 129) | class ScopedWS(object):
    method __init__ (line 130) | def __init__(self, ws_name, is_reset, is_cleanup=False):
    method __enter__ (line 136) | def __enter__(self):
    method __exit__ (line 145) | def __exit__(self, *args):
  function fetch_any_blob (line 152) | def fetch_any_blob(name):
  function get_pb_arg (line 167) | def get_pb_arg(pb, arg_name):
  function get_pb_arg_valf (line 174) | def get_pb_arg_valf(pb, arg_name, default_val):
  function get_pb_arg_floats (line 179) | def get_pb_arg_floats(pb, arg_name, default_val):
  function get_pb_arg_ints (line 184) | def get_pb_arg_ints(pb, arg_name, default_val):
  function get_pb_arg_vali (line 189) | def get_pb_arg_vali(pb, arg_name, default_val):
  function get_pb_arg_vals (line 194) | def get_pb_arg_vals(pb, arg_name, default_val):
  function get_pb_arg_valstrings (line 199) | def get_pb_arg_valstrings(pb, arg_name, default_val):
  function check_set_pb_arg (line 204) | def check_set_pb_arg(pb, arg_name, arg_attr, arg_value, allow_override=F...
  function _create_const_fill_op_from_numpy (line 222) | def _create_const_fill_op_from_numpy(name, tensor, device_option=None):
  function _create_const_fill_op_from_c2_int8_tensor (line 243) | def _create_const_fill_op_from_c2_int8_tensor(name, int8_tensor):
  function create_const_fill_op (line 265) | def create_const_fill_op(
  function construct_init_net_from_params (line 287) | def construct_init_net_from_params(
  function get_producer_map (line 311) | def get_producer_map(ssa):
  function get_consumer_map (line 324) | def get_consumer_map(ssa):
  function get_params_from_init_net (line 337) | def get_params_from_init_net(
  function _updater_raise (line 366) | def _updater_raise(op, input_types, output_types):
  function _generic_status_identifier (line 373) | def _generic_status_identifier(
  function infer_device_type (line 445) | def infer_device_type(
  function _modify_blob_names (line 488) | def _modify_blob_names(ops, blob_rename_f):
  function _rename_blob (line 504) | def _rename_blob(name, blob_sizes, blob_ranges):
  function save_graph (line 520) | def save_graph(net, file_name, graph_name="net", op_only=True, blob_size...
  function save_graph_base (line 525) | def save_graph_base(net, file_name, graph_name="net", op_only=True, blob...
  function group_norm_replace_aten_with_caffe2 (line 560) | def group_norm_replace_aten_with_caffe2(predict_net: caffe2_pb2.NetDef):
  function alias (line 589) | def alias(x, name, is_backward=False):
  function fuse_alias_placeholder (line 596) | def fuse_alias_placeholder(predict_net, init_net):
  class IllegalGraphTransformError (line 624) | class IllegalGraphTransformError(ValueError):
  function _rename_versioned_blob_in_proto (line 628) | def _rename_versioned_blob_in_proto(
  function rename_op_input (line 659) | def rename_op_input(
  function rename_op_output (line 726) | def rename_op_output(predict_net: caffe2_pb2.NetDef, op_id: int, output_...
  function get_sub_graph_external_input_output (line 747) | def get_sub_graph_external_input_output(
  class DiGraph (line 779) | class DiGraph:
    method __init__ (line 782) | def __init__(self):
    method add_edge (line 786) | def add_edge(self, u, v):
    method get_all_paths (line 792) | def get_all_paths(self, s, d):
    method from_ssa (line 813) | def from_ssa(ssa):
  function _get_dependency_chain (line 822) | def _get_dependency_chain(ssa, versioned_target, versioned_source):
  function identify_reshape_sub_graph (line 852) | def identify_reshape_sub_graph(predict_net: caffe2_pb2.NetDef,) -> List[...
  function remove_reshape_for_fc (line 879) | def remove_reshape_for_fc(predict_net, params):
  function fuse_copy_between_cpu_and_gpu (line 949) | def fuse_copy_between_cpu_and_gpu(predict_net: caffe2_pb2.NetDef):
  function remove_dead_end_ops (line 1007) | def remove_dead_end_ops(net_def: caffe2_pb2.NetDef):

FILE: detectron2/layers/aspp.py
  class ASPP (line 14) | class ASPP(nn.Module):
    method __init__ (line 19) | def __init__(
    method forward (line 129) | def forward(self, x):

FILE: detectron2/layers/batch_norm.py
  class FrozenBatchNorm2d (line 13) | class FrozenBatchNorm2d(nn.Module):
    method __init__ (line 35) | def __init__(self, num_features, eps=1e-5):
    method forward (line 44) | def forward(self, x):
    method _load_from_state_dict (line 67) | def _load_from_state_dict(
    method __repr__ (line 84) | def __repr__(self):
    method convert_frozen_batchnorm (line 88) | def convert_frozen_batchnorm(cls, module):
  function get_norm (line 121) | def get_norm(norm, out_channels):
  class NaiveSyncBatchNorm (line 152) | class NaiveSyncBatchNorm(BatchNorm2d):
    method __init__ (line 180) | def __init__(self, *args, stats_mode="", **kwargs):
    method forward (line 185) | def forward(self, input):
  class CycleBatchNormList (line 233) | class CycleBatchNormList(nn.ModuleList):
    method __init__ (line 249) | def __init__(self, length: int, bn_class=nn.BatchNorm2d, **kwargs):
    method forward (line 265) | def forward(self, x):
    method extra_repr (line 276) | def extra_repr(self):
  class LayerNorm (line 280) | class LayerNorm(nn.Module):
    method __init__ (line 288) | def __init__(self, normalized_shape, eps=1e-6):
    method forward (line 295) | def forward(self, x):

FILE: detectron2/layers/blocks.py
  class CNNBlockBase (line 16) | class CNNBlockBase(nn.Module):
    method __init__ (line 29) | def __init__(self, in_channels, out_channels, stride):
    method freeze (line 43) | def freeze(self):
  class DepthwiseSeparableConv2d (line 58) | class DepthwiseSeparableConv2d(nn.Module):
    method __init__ (line 66) | def __init__(
    method forward (line 110) | def forward(self, x):

FILE: detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h
  function namespace (line 5) | namespace detectron2 {

FILE: detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp
  type detectron2 (line 12) | namespace detectron2 {
    type PreCalc (line 16) | struct PreCalc {
    function pre_calc_for_bilinear_interpolate (line 28) | void pre_calc_for_bilinear_interpolate(
    function bilinear_interpolate_gradient (line 132) | void bilinear_interpolate_gradient(
    function add (line 195) | inline void add(T* address, const T& val) {
    function ROIAlignRotatedForward (line 202) | void ROIAlignRotatedForward(
    function ROIAlignRotatedBackward (line 313) | void ROIAlignRotatedBackward(
    function ROIAlignRotated_forward_cpu (line 418) | at::Tensor ROIAlignRotated_forward_cpu(
    function ROIAlignRotated_backward_cpu (line 466) | at::Tensor ROIAlignRotated_backward_cpu(

FILE: detectron2/layers/csrc/box_iou_rotated/box_iou_rotated.h
  function namespace (line 5) | namespace detectron2 {

FILE: detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cpu.cpp
  type detectron2 (line 5) | namespace detectron2 {
    function box_iou_rotated_cpu_kernel (line 8) | void box_iou_rotated_cpu_kernel(
    function box_iou_rotated_cpu (line 23) | at::Tensor box_iou_rotated_cpu(

FILE: detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_utils.h
  function namespace (line 17) | namespace detectron2 {

FILE: detectron2/layers/csrc/cocoeval/cocoeval.cpp
  type detectron2 (line 10) | namespace detectron2 {
    type COCOeval (line 12) | namespace COCOeval {
      function SortInstancesByDetectionScore (line 18) | void SortInstancesByDetectionScore(
      function SortInstancesByIgnore (line 34) | void SortInstancesByIgnore(
      function MatchDetectionsToGroundTruth (line 61) | void MatchDetectionsToGroundTruth(
      function EvaluateImages (line 142) | std::vector<ImageEvaluation> EvaluateImages(
      function list_to_vec (line 203) | std::vector<T> list_to_vec(const py::list& l) {
      function BuildSortedDetectionList (line 223) | int BuildSortedDetectionList(
      function ComputePrecisionRecallCurve (line 284) | void ComputePrecisionRecallCurve(
      function Accumulate (line 372) | py::dict Accumulate(

FILE: detectron2/layers/csrc/cocoeval/cocoeval.h
  function namespace (line 12) | namespace detectron2 {

FILE: detectron2/layers/csrc/deformable/deform_conv.h
  function namespace (line 5) | namespace detectron2 {

FILE: detectron2/layers/csrc/nms_rotated/nms_rotated.h
  function namespace (line 5) | namespace detectron2 {

FILE: detectron2/layers/csrc/nms_rotated/nms_rotated_cpu.cpp
  type detectron2 (line 5) | namespace detectron2 {
    function nms_rotated_cpu_kernel (line 8) | at::Tensor nms_rotated_cpu_kernel(
    function nms_rotated_cpu (line 62) | at::Tensor nms_rotated_cpu(

FILE: detectron2/layers/csrc/vision.cpp
  type detectron2 (line 10) | namespace detectron2 {
    function get_cuda_version (line 16) | std::string get_cuda_version() {
    function has_cuda (line 41) | bool has_cuda() {
    function get_compiler_version (line 51) | std::string get_compiler_version() {
    function PYBIND11_MODULE (line 77) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
    function TORCH_LIBRARY (line 111) | TORCH_LIBRARY(detectron2, m) {

FILE: detectron2/layers/deform_conv.py
  class _DeformConv (line 16) | class _DeformConv(Function):
    method forward (line 18) | def forward(
    method backward (line 85) | def backward(ctx, grad_output):
    method _output_size (line 146) | def _output_size(input, weight, padding, dilation, stride):
    method _cal_im2col_step (line 165) | def _cal_im2col_step(input_size, default_size):
  class _ModulatedDeformConv (line 187) | class _ModulatedDeformConv(Function):
    method forward (line 189) | def forward(
    method backward (line 246) | def backward(ctx, grad_output):
    method _infer_shape (line 298) | def _infer_shape(ctx, input, weight):
  class DeformConv (line 316) | class DeformConv(nn.Module):
    method __init__ (line 317) | def __init__(
    method forward (line 369) | def forward(self, x, offset):
    method extra_repr (line 400) | def extra_repr(self):
  class ModulatedDeformConv (line 413) | class ModulatedDeformConv(nn.Module):
    method __init__ (line 414) | def __init__(
    method forward (line 463) | def forward(self, x, offset, mask):
    method extra_repr (line 492) | def extra_repr(self):

FILE: detectron2/layers/losses.py
  function diou_loss (line 5) | def diou_loss(
  function ciou_loss (line 66) | def ciou_loss(

FILE: detectron2/layers/mask_ops.py
  function _do_paste_mask (line 17) | def _do_paste_mask(masks, boxes, img_h: int, img_w: int, skip_empty: boo...
  function paste_masks_in_image (line 74) | def paste_masks_in_image(
  function paste_mask_in_image_old (line 155) | def paste_mask_in_image_old(mask, box, img_h, img_w, threshold):
  function pad_masks (line 219) | def pad_masks(masks, padding):
  function scale_boxes (line 237) | def scale_boxes(boxes, scale):
  function _paste_masks_tensor_shape (line 264) | def _paste_masks_tensor_shape(

FILE: detectron2/layers/nms.py
  function batched_nms (line 9) | def batched_nms(
  function nms_rotated (line 25) | def nms_rotated(boxes, scores, iou_threshold):
  function batched_nms_rotated (line 91) | def batched_nms_rotated(boxes, scores, idxs, iou_threshold):

FILE: detectron2/layers/roi_align.py
  class ROIAlign (line 7) | class ROIAlign(nn.Module):
    method __init__ (line 8) | def __init__(self, output_size, spatial_scale, sampling_ratio, aligned...
    method forward (line 49) | def forward(self, input, rois):
    method __repr__ (line 67) | def __repr__(self):

FILE: detectron2/layers/roi_align_rotated.py
  class _ROIAlignRotated (line 9) | class _ROIAlignRotated(Function):
    method forward (line 11) | def forward(ctx, input, roi, output_size, spatial_scale, sampling_ratio):
    method backward (line 24) | def backward(ctx, grad_output):
  class ROIAlignRotated (line 48) | class ROIAlignRotated(nn.Module):
    method __init__ (line 49) | def __init__(self, output_size, spatial_scale, sampling_ratio):
    method forward (line 69) | def forward(self, input, rois):
    method __repr__ (line 85) | def __repr__(self):

FILE: detectron2/layers/rotated_boxes.py
  function pairwise_iou_rotated (line 6) | def pairwise_iou_rotated(boxes1, boxes2):

FILE: detectron2/layers/shape_spec.py
  class ShapeSpec (line 8) | class ShapeSpec:

FILE: detectron2/layers/wrappers.py
  function shapes_to_tensor (line 17) | def shapes_to_tensor(x: List[int], device: Optional[torch.device] = None...
  function cat (line 39) | def cat(tensors: List[torch.Tensor], dim: int = 0):
  function empty_input_loss_func_wrapper (line 49) | def empty_input_loss_func_wrapper(loss_func):
  class _NewEmptyTensorOp (line 64) | class _NewEmptyTensorOp(torch.autograd.Function):
    method forward (line 66) | def forward(ctx, x, new_shape):
    method backward (line 71) | def backward(ctx, grad):
  class Conv2d (line 76) | class Conv2d(torch.nn.Conv2d):
    method __init__ (line 81) | def __init__(self, *args, **kwargs):
    method forward (line 98) | def forward(self, x):
  function nonzero_tuple (line 129) | def nonzero_tuple(x):
  function move_device_like (line 143) | def move_device_like(src: torch.Tensor, dst: torch.Tensor) -> torch.Tensor:

FILE: detectron2/modeling/anchor_generator.py
  class BufferList (line 18) | class BufferList(nn.Module):
    method __init__ (line 23) | def __init__(self, buffers=None):
    method extend (line 28) | def extend(self, buffers):
    method __len__ (line 34) | def __len__(self):
    method __iter__ (line 37) | def __iter__(self):
  function _create_grid_offsets (line 41) | def _create_grid_offsets(size, stride, device):
  class DefaultAnchorGenerator (line 54) | class DefaultAnchorGenerator(nn.Module):
    method __init__ (line 59) | def __init__(self, cfg, input_shape: List[ShapeSpec]):
    method _calculate_anchors (line 82) | def _calculate_anchors(self, sizes, aspect_ratios):
    method box_dim (line 100) | def box_dim(self):
    method num_cell_anchors (line 108) | def num_cell_anchors(self):
    method grid_anchors (line 121) | def grid_anchors(self, grid_sizes):
    method generate_cell_anchors (line 131) | def generate_cell_anchors(self, sizes=(32, 64, 128, 256, 512), aspect_...
    method forward (line 168) | def forward(self, features):
  class RotatedAnchorGenerator (line 191) | class RotatedAnchorGenerator(nn.Module):
    method __init__ (line 196) | def __init__(self, cfg, input_shape: List[ShapeSpec]):
    method _calculate_anchors (line 208) | def _calculate_anchors(self, sizes, aspect_ratios, angles, feature_str...
    method box_dim (line 250) | def box_dim(self):
    method num_cell_anchors (line 258) | def num_cell_anchors(self):
    method grid_anchors (line 272) | def grid_anchors(self, grid_sizes):
    method generate_cell_anchors (line 283) | def generate_cell_anchors(
    method forward (line 322) | def forward(self, features):
  function build_anchor_generator (line 345) | def build_anchor_generator(cfg, input_shape):

FILE: detectron2/modeling/backbone/backbone.py
  class Backbone (line 10) | class Backbone(nn.Module, metaclass=ABCMeta):
    method __init__ (line 15) | def __init__(self):
    method forward (line 22) | def forward(self):
    method size_divisibility (line 32) | def size_divisibility(self):
    method output_shape (line 42) | def output_shape(self):
    method out_features (line 58) | def out_features(self):
    method out_feature_strides (line 63) | def out_feature_strides(self):
    method out_feature_channels (line 68) | def out_feature_channels(self):

FILE: detectron2/modeling/backbone/build.py
  function build_backbone (line 20) | def build_backbone(cfg, input_shape=None):

FILE: detectron2/modeling/backbone/fpn.py
  class FPN (line 16) | class FPN(Backbone):
    method __init__ (line 22) | def __init__(
    method size_divisibility (line 105) | def size_divisibility(self):
    method forward (line 108) | def forward(self, x):
    method output_shape (line 145) | def output_shape(self):
  function _assert_strides_are_log2_contiguous (line 154) | def _assert_strides_are_log2_contiguous(strides):
  class LastLevelMaxPool (line 164) | class LastLevelMaxPool(nn.Module):
    method __init__ (line 170) | def __init__(self):
    method forward (line 175) | def forward(self, x):
  class LastLevelP6P7 (line 179) | class LastLevelP6P7(nn.Module):
    method __init__ (line 185) | def __init__(self, in_channels, out_channels):
    method forward (line 194) | def forward(self, c5):
  function build_resnet_fpn_backbone (line 201) | def build_resnet_fpn_backbone(cfg, input_shape: ShapeSpec):
  function build_retinanet_resnet_fpn_backbone (line 224) | def build_retinanet_resnet_fpn_backbone(cfg, input_shape: ShapeSpec):

FILE: detectron2/modeling/backbone/resnet.py
  class ResNetBlockBase (line 31) | class ResNetBlockBase(nn.Module):
    method __init__ (line 32) | def __init__(self, in_channels, out_channels, stride):
    method freeze (line 46) | def freeze(self):
  class BottleneckBlock (line 53) | class BottleneckBlock(ResNetBlockBase):
    method __init__ (line 54) | def __init__(
    method forward (line 138) | def forward(self, x):
  class DeformBottleneckBlock (line 157) | class DeformBottleneckBlock(ResNetBlockBase):
    method __init__ (line 158) | def __init__(
    method forward (line 245) | def forward(self, x):
  function make_stage (line 272) | def make_stage(block_class, num_blocks, first_stride, **kwargs):
  class BasicStem (line 292) | class BasicStem(nn.Module):
    method __init__ (line 293) | def __init__(self, in_channels=3, out_channels=64, norm="BN"):
    method forward (line 312) | def forward(self, x):
    method out_channels (line 319) | def out_channels(self):
    method stride (line 323) | def stride(self):
  class ResNet (line 327) | class ResNet(Backbone):
    method __init__ (line 328) | def __init__(self, stem, stages, num_classes=None, out_features=None):
    method forward (line 379) | def forward(self, x):
    method output_shape (line 395) | def output_shape(self):
  function build_resnet_backbone (line 405) | def build_resnet_backbone(cfg, input_shape):

FILE: detectron2/modeling/box_regression.py
  class Box2BoxTransform (line 14) | class Box2BoxTransform(object):
    method __init__ (line 21) | def __init__(self, weights, scale_clamp=_DEFAULT_SCALE_CLAMP):
    method get_deltas (line 34) | def get_deltas(self, src_boxes, target_boxes):
    method trans_light (line 68) | def trans_light(self, src_boxes):
    method apply_deltas (line 74) | def apply_deltas(self, deltas, boxes):
  class Box2BoxTransformRotated (line 115) | class Box2BoxTransformRotated(object):
    method __init__ (line 124) | def __init__(self, weights, scale_clamp=_DEFAULT_SCALE_CLAMP):
    method get_deltas (line 136) | def get_deltas(self, src_boxes, target_boxes):
    method apply_deltas (line 177) | def apply_deltas(self, deltas, boxes):

FILE: detectron2/modeling/matcher.py
  class Matcher (line 5) | class Matcher(object):
    method __init__ (line 21) | def __init__(self, thresholds, labels, allow_low_quality_matches=False):
    method __call__ (line 54) | def __call__(self, match_quality_matrix):
    method set_low_quality_matches_ (line 95) | def set_low_quality_matches_(self, match_labels, match_quality_matrix):

FILE: detectron2/modeling/meta_arch/LISA_meta_arch.py
  class LISARCNN (line 19) | class LISARCNN(GeneralizedRCNN):
    method __init__ (line 21) | def __init__(self,cfg):
    method forward (line 26) | def forward(self, batched_inputs):
    method inference (line 64) | def inference(self, batched_inputs, detected_instances=None, do_postpr...

FILE: detectron2/modeling/meta_arch/build.py
  function build_model (line 13) | def build_model(cfg):

FILE: detectron2/modeling/meta_arch/panoptic_fpn.py
  class PanopticFPN (line 20) | class PanopticFPN(nn.Module):
    method __init__ (line 25) | def __init__(self, cfg):
    method forward (line 50) | def forward(self, batched_inputs):
  function combine_semantic_and_instance_outputs (line 131) | def combine_semantic_and_instance_outputs(

FILE: detectron2/modeling/meta_arch/rcnn.py
  class GeneralizedRCNN (line 19) | class GeneralizedRCNN(nn.Module):
    method __init__ (line 27) | def __init__(self, cfg):
    method forward (line 42) | def forward(self, batched_inputs):
    method inference (line 95) | def inference(self, batched_inputs, detected_instances=None, do_postpr...
    method preprocess_image (line 142) | def preprocess_image(self, batched_inputs):
  class ProposalNetwork (line 153) | class ProposalNetwork(nn.Module):
    method __init__ (line 154) | def __init__(self, cfg):
    method forward (line 166) | def forward(self, batched_inputs):

FILE: detectron2/modeling/meta_arch/retinanet.py
  function permute_to_N_HWA_K (line 23) | def permute_to_N_HWA_K(tensor, K):
  function permute_all_cls_and_box_to_N_HWA_K_and_concat (line 35) | def permute_all_cls_and_box_to_N_HWA_K_and_concat(box_cls, box_delta, nu...
  class RetinaNet (line 57) | class RetinaNet(nn.Module):
    method __init__ (line 62) | def __init__(self, cfg):
    method forward (line 101) | def forward(self, batched_inputs):
    method losses (line 150) | def losses(self, gt_classes, gt_anchors_deltas, pred_class_logits, pre...
    method get_ground_truth (line 200) | def get_ground_truth(self, anchors, targets):
    method inference (line 258) | def inference(self, box_cls, box_delta, anchors, images):
    method inference_single_image (line 287) | def inference_single_image(self, box_cls, box_delta, anchors, image_si...
    method preprocess_image (line 349) | def preprocess_image(self, batched_inputs):
  class RetinaNetHead (line 359) | class RetinaNetHead(nn.Module):
    method __init__ (line 365) | def __init__(self, cfg, input_shape: List[ShapeSpec]):
    method forward (line 409) | def forward(self, features):

FILE: detectron2/modeling/meta_arch/semantic_seg.py
  class SemanticSegmentor (line 28) | class SemanticSegmentor(nn.Module):
    method __init__ (line 33) | def __init__(self, cfg):
    method forward (line 47) | def forward(self, batched_inputs):
  function build_sem_seg_head (line 93) | def build_sem_seg_head(cfg, input_shape):
  class SemSegFPNHead (line 102) | class SemSegFPNHead(nn.Module):
    method __init__ (line 109) | def __init__(self, cfg, input_shape: Dict[str, ShapeSpec]):
    method forward (line 153) | def forward(self, features, targets=None):

FILE: detectron2/modeling/poolers.py
  function assign_boxes_to_levels (line 13) | def assign_boxes_to_levels(box_lists, min_level, max_level, canonical_bo...
  function convert_boxes_to_pooler_format (line 45) | def convert_boxes_to_pooler_format(box_lists):
  class ROIPooler (line 82) | class ROIPooler(nn.Module):
    method __init__ (line 88) | def __init__(
    method forward (line 160) | def forward(self, x, box_lists):

FILE: detectron2/modeling/postprocessing.py
  function decode (line 11) | def decode(segm):
  function encode (line 15) | def encode(segm):
  function detector_postprocess (line 19) | def detector_postprocess(results, output_height, output_width, mask_thre...
  function sem_seg_postprocess (line 67) | def sem_seg_postprocess(result, img_size, output_height, output_width):
  function takeTwo (line 92) | def takeTwo(elm):
  function compute_iou (line 104) | def compute_iou(rec1, rec2):
  function box_combine (line 117) | def box_combine(o, s, box1, box2):
  function compute_direction (line 133) | def compute_direction(box1,box2):
  function rect_distance (line 136) | def rect_distance(a, b):
  function dist (line 163) | def dist(a, b):
  function matchor (line 167) | def matchor(instance, association):
  function combine_association (line 246) | def combine_association(instance, association):

FILE: detectron2/modeling/proposal_generator/LISA_rpn.py
  function build_rpn_head (line 25) | def build_rpn_head(cfg, input_shape,shadow_object_part=False):
  class LISARPNHead (line 34) | class LISARPNHead(StandardRPNHead):
    method __init__ (line 35) | def __init__(self, cfg, input_shape: List[ShapeSpec], shadow_object_pa...
    method forward (line 47) | def forward(self, features):
  function build_proposal_generator (line 73) | def build_proposal_generator(cfg, input_shape, **args):
  class LISARPN (line 85) | class LISARPN(RPN):
    method __init__ (line 87) | def __init__(self, cfg, input_shape: Dict[str, ShapeSpec], shadow_obje...
    method forward (line 93) | def forward(self, images, features, gt_instances=None, pre_proposals=N...

FILE: detectron2/modeling/proposal_generator/build.py
  function build_proposal_generator (line 15) | def build_proposal_generator(cfg, input_shape):

FILE: detectron2/modeling/proposal_generator/proposal_utils.py
  function add_ground_truth_to_proposals (line 8) | def add_ground_truth_to_proposals(gt_boxes, proposals, gt_light =None):
  function add_ground_truth_to_proposals_single_image (line 35) | def add_ground_truth_to_proposals_single_image(gt_boxes, proposals,gt_li...

FILE: detectron2/modeling/proposal_generator/rpn.py
  function build_rpn_head (line 23) | def build_rpn_head(cfg, input_shape):
  class StandardRPNHead (line 32) | class StandardRPNHead(nn.Module):
    method __init__ (line 40) | def __init__(self, cfg, input_shape: List[ShapeSpec]):
    method forward (line 71) | def forward(self, features):
  class RPN (line 86) | class RPN(nn.Module):
    method __init__ (line 91) | def __init__(self, cfg, input_shape: Dict[str, ShapeSpec]):
    method forward (line 124) | def forward(self, images, features, gt_instances=None):

FILE: detectron2/modeling/proposal_generator/rpn_outputs.py
  function find_top_rpn_proposals (line 51) | def find_top_rpn_proposals(
  function rpn_losses (line 153) | def rpn_losses(
  class RPNOutputs (line 192) | class RPNOutputs(object):
    method __init__ (line 193) | def __init__(
    method _get_ground_truth (line 249) | def _get_ground_truth(self):
    method losses (line 291) | def losses(self):
    method predict_proposals (line 393) | def predict_proposals(self):
    method predict_objectness_logits (line 426) | def predict_objectness_logits(self):

FILE: detectron2/modeling/proposal_generator/rrpn.py
  class RRPN (line 17) | class RRPN(RPN):
    method __init__ (line 26) | def __init__(self, cfg, input_shape: Dict[str, ShapeSpec]):
    method forward (line 30) | def forward(self, images, features, gt_instances=None):

FILE: detectron2/modeling/proposal_generator/rrpn_outputs.py
  function find_top_rrpn_proposals (line 41) | def find_top_rrpn_proposals(
  class RRPNOutputs (line 143) | class RRPNOutputs(RPNOutputs):
    method __init__ (line 144) | def __init__(
    method _get_ground_truth (line 200) | def _get_ground_truth(self):

FILE: detectron2/modeling/roi_heads/LISA_rcnn.py
  class RelationROIHeads (line 24) | class RelationROIHeads(StandardROIHeads):
    method _init_box_head (line 35) | def _init_box_head(self,cfg):
    method forward (line 71) | def forward(self,images, features, relation_proposals, proposals, rela...
    method _forward_relation_box (line 113) | def _forward_relation_box(self, features, relation_proposals):
    method label_and_sample_proposals (line 140) | def label_and_sample_proposals(self, proposals, targets, isrelation = ...

FILE: detectron2/modeling/roi_heads/box_head.py
  class FastRCNNConvFCHead (line 20) | class FastRCNNConvFCHead(nn.Module):
    method __init__ (line 26) | def __init__(self, cfg, input_shape: ShapeSpec):
    method forward (line 73) | def forward(self, x):
    method output_size (line 84) | def output_size(self):
  function build_box_head (line 88) | def build_box_head(cfg, input_shape):

FILE: detectron2/modeling/roi_heads/cascade_rcnn.py
  class _ScaleGradient (line 18) | class _ScaleGradient(Function):
    method forward (line 20) | def forward(ctx, input, scale):
    method backward (line 25) | def backward(ctx, grad_output):
  class CascadeROIHeads (line 30) | class CascadeROIHeads(StandardROIHeads):
    method _init_box_head (line 31) | def _init_box_head(self, cfg):
    method forward (line 83) | def forward(self, images, features, proposals, targets=None):
    method _forward_box (line 101) | def _forward_box(self, features, proposals, targets=None):
    method _match_and_label_boxes (line 144) | def _match_and_label_boxes(self, proposals, stage, targets):
    method _run_stage (line 193) | def _run_stage(self, features, proposals, stage):
    method _create_proposals_from_boxes (line 222) | def _create_proposals_from_boxes(self, boxes, image_sizes):

FILE: detectron2/modeling/roi_heads/fast_rcnn.py
  function fast_rcnn_losses (line 41) | def fast_rcnn_losses(
  function fast_rcnn_inference (line 155) | def fast_rcnn_inference(boxes, scores, image_shapes, score_thresh, nms_t...
  function fast_rcnn_inference_single_image (line 199) | def fast_rcnn_inference_single_image(
  class FastRCNNOutputs (line 256) | class FastRCNNOutputs(object):
    method __init__ (line 261) | def __init__(
    method _log_accuracy (line 303) | def _log_accuracy(self):
    method losses (line 326) | def losses(self):
    method predict_boxes (line 357) | def predict_boxes(self):
    method predict_light (line 368) | def predict_light(self,light):
    method predict_probs (line 371) | def predict_probs(self):
    method inference (line 382) | def inference(self, score_thresh, nms_thresh, topk_per_image):
  class FastRCNNOutputLayers (line 404) | class FastRCNNOutputLayers(nn.Module):
    method __init__ (line 411) | def __init__(self, input_size, num_classes, cls_agnostic_bbox_reg, box...
    method forward (line 436) | def forward(self, x):
  class LightdirectionOutputLayer (line 443) | class LightdirectionOutputLayer(nn.Module):
    method __init__ (line 445) | def __init__(self, input_size, box_dim =4):
    method forward (line 456) | def forward(self,x):

FILE: detectron2/modeling/roi_heads/keypoint_head.py
  function build_keypoint_head (line 21) | def build_keypoint_head(cfg, input_shape):
  function keypoint_rcnn_loss (line 29) | def keypoint_rcnn_loss(pred_keypoint_logits, instances, normalizer):
  function keypoint_rcnn_inference (line 92) | def keypoint_rcnn_inference(pred_keypoint_logits, pred_instances):
  class KRCNNConvDeconvUpsampleHead (line 122) | class KRCNNConvDeconvUpsampleHead(nn.Module):
    method __init__ (line 128) | def __init__(self, cfg, input_shape: ShapeSpec):
    method forward (line 167) | def forward(self, x):

FILE: detectron2/modeling/roi_heads/mask_head.py
  function mask_rcnn_loss (line 20) | def mask_rcnn_loss(pred_mask_logits, instances):
  function mask_rcnn_inference (line 95) | def mask_rcnn_inference(pred_mask_logits, pred_instances):
  class MaskRCNNConvUpsampleHead (line 137) | class MaskRCNNConvUpsampleHead(nn.Module):
    method __init__ (line 142) | def __init__(self, cfg, input_shape: ShapeSpec):
    method forward (line 194) | def forward(self, x):
  function build_mask_head (line 201) | def build_mask_head(cfg, input_shape):

FILE: detectron2/modeling/roi_heads/roi_heads.py
  function build_roi_heads (line 37) | def build_roi_heads(cfg, input_shape):
  function select_foreground_proposals (line 45) | def select_foreground_proposals(proposals, bg_label):
  function select_proposals_with_visible_keypoints (line 75) | def select_proposals_with_visible_keypoints(proposals):
  class ROIHeads (line 116) | class ROIHeads(torch.nn.Module):
    method __init__ (line 126) | def __init__(self, cfg, input_shape: Dict[str, ShapeSpec]):
    method label_and_sample_proposals (line 155) | def label_and_sample_proposals(self, proposals, targets):
    method forward (line 253) | def forward(self, images, features, proposals, targets=None):
  class Res5ROIHeads (line 283) | class Res5ROIHeads(ROIHeads):
    method __init__ (line 290) | def __init__(self, cfg, input_shape):
    method _build_res5_block (line 322) | def _build_res5_block(self, cfg):
    method _shared_roi_transform (line 348) | def _shared_roi_transform(self, features, boxes):
    method forward (line 352) | def forward(self, images, features, proposals, targets=None):
    method forward_with_given_boxes (line 401) | def forward_with_given_boxes(self, features, instances):
  class StandardROIHeads (line 427) | class StandardROIHeads(ROIHeads):
    method __init__ (line 439) | def __init__(self, cfg, input_shape):
    method _init_box_head (line 445) | def _init_box_head(self, cfg):
    method _init_mask_head (line 476) | def _init_mask_head(self, cfg):
    method _init_keypoint_head (line 499) | def _init_keypoint_head(self, cfg):
    method forward (line 524) | def forward(self, images, features, proposals, targets=None):
    method forward_with_given_boxes (line 549) | def forward_with_given_boxes(self, features, instances):
    method _forward_box (line 575) | def _forward_box(self, features, proposals):
    method _forward_mask (line 610) | def _forward_mask(self, features, instances):
    method _forward_keypoint (line 641) | def _forward_keypoint(self, features, instances):
  class RROIHeads (line 690) | class RROIHeads(StandardROIHeads):
    method __init__ (line 696) | def __init__(self, cfg, input_shape: Dict[str, ShapeSpec]):
    method _init_box_head (line 702) | def _init_box_head(self, cfg):
    method label_and_sample_proposals (line 735) | def label_and_sample_proposals(self, proposals, targets):

FILE: detectron2/modeling/roi_heads/rotated_fast_rcnn.py
  function fast_rcnn_inference_rotated (line 46) | def fast_rcnn_inference_rotated(
  function fast_rcnn_inference_single_image_rotated (line 83) | def fast_rcnn_inference_single_image_rotated(
  class RotatedFastRCNNOutputs (line 129) | class RotatedFastRCNNOutputs(FastRCNNOutputs):
    method inference (line 134) | def inference(self, score_thresh, nms_thresh, topk_per_image):
  class RROIHeads (line 154) | class RROIHeads(StandardROIHeads):
    method __init__ (line 160) | def __init__(self, cfg, input_shape: Dict[str, ShapeSpec]):
    method _init_box_head (line 169) | def _init_box_head(self, cfg):
    method label_and_sample_proposals (line 204) | def label_and_sample_proposals(self, proposals, targets):
    method _forward_box (line 265) | def _forward_box(self, features, proposals):

FILE: detectron2/modeling/sampling.py
  function subsample_labels (line 7) | def subsample_labels(labels, num_samples, positive_fraction, bg_label):

FILE: detectron2/modeling/test_time_augmentation.py
  class DatasetMapperTTA (line 20) | class DatasetMapperTTA:
    method __init__ (line 29) | def __init__(self, cfg):
    method __call__ (line 35) | def __call__(self, dataset_dict):
  class GeneralizedRCNNWithTTA (line 69) | class GeneralizedRCNNWithTTA(nn.Module):
    method __init__ (line 75) | def __init__(self, cfg, model, tta_mapper=None, batch_size=3):
    method _turn_off_roi_head (line 103) | def _turn_off_roi_head(self, attr):
    method _batch_inference (line 124) | def _batch_inference(self, batched_inputs, detected_instances=None, do...
    method __call__ (line 150) | def __call__(self, batched_inputs):
    method _inference_one_image (line 156) | def _inference_one_image(self, input):

FILE: detectron2/solver/build.py
  function build_optimizer (line 10) | def build_optimizer(cfg: CfgNode, model: torch.nn.Module) -> torch.optim...
  function build_lr_scheduler (line 35) | def build_lr_scheduler(

FILE: detectron2/solver/lr_scheduler.py
  class WarmupMultiStepLR (line 16) | class WarmupMultiStepLR(torch.optim.lr_scheduler._LRScheduler):
    method __init__ (line 17) | def __init__(
    method get_lr (line 38) | def get_lr(self) -> List[float]:
    method _compute_values (line 47) | def _compute_values(self) -> List[float]:
  class WarmupCosineLR (line 52) | class WarmupCosineLR(torch.optim.lr_scheduler._LRScheduler):
    method __init__ (line 53) | def __init__(
    method get_lr (line 68) | def get_lr(self) -> List[float]:
    method _compute_values (line 85) | def _compute_values(self) -> List[float]:
  function _get_warmup_factor_at_iter (line 90) | def _get_warmup_factor_at_iter(

FILE: detectron2/structures/boxes.py
  class BoxMode (line 13) | class BoxMode(Enum):
    method convert (line 32) | def convert(box: _RawBoxType, from_mode: "BoxMode", to_mode: "BoxMode"...
  class Boxes (line 71) | class Boxes:
    method __init__ (line 85) | def __init__(self, tensor: torch.Tensor):
    method clone (line 98) | def clone(self) -> "Boxes":
    method to (line 107) | def to(self, device: str) -> "Boxes":
    method area (line 110) | def area(self) -> torch.Tensor:
    method clip (line 121) | def clip(self, box_size: BoxSizeType) -> None:
    method nonempty (line 136) | def nonempty(self, threshold: int = 0) -> torch.Tensor:
    method __getitem__ (line 152) | def __getitem__(self, item: Union[int, slice, torch.BoolTensor]) -> "B...
    method __len__ (line 172) | def __len__(self) -> int:
    method __repr__ (line 175) | def __repr__(self) -> str:
    method inside_box (line 178) | def inside_box(self, box_size: BoxSizeType, boundary_threshold: int = ...
    method get_centers (line 197) | def get_centers(self) -> torch.Tensor:
    method cat (line 205) | def cat(boxes_list: List["Boxes"]) -> "Boxes":
    method device (line 223) | def device(self) -> str:
    method __iter__ (line 226) | def __iter__(self) -> Iterator[torch.Tensor]:
  function pairwise_iou (line 235) | def pairwise_iou(boxes1: Boxes, boxes2: Boxes) -> torch.Tensor:
  function matched_boxlist_iou (line 268) | def matched_boxlist_iou(boxes1: Boxes, boxes2: Boxes) -> torch.Tensor:

FILE: detectron2/structures/image_list.py
  class ImageList (line 8) | class ImageList(object):
    method __init__ (line 19) | def __init__(self, tensor: torch.Tensor, image_sizes: List[Tuple[int, ...
    method __len__ (line 28) | def __len__(self) -> int:
    method __getitem__ (line 31) | def __getitem__(self, idx: Union[int, slice]) -> torch.Tensor:
    method to (line 41) | def to(self, *args: Any, **kwargs: Any) -> "ImageList":
    method from_tensors (line 46) | def from_tensors(

FILE: detectron2/structures/instances.py
  class Instances (line 9) | class Instances:
    method __init__ (line 31) | def __init__(self, image_size: Tuple[int, int], **kwargs: Any):
    method image_size (line 43) | def image_size(self) -> Tuple[int, int]:
    method __setattr__ (line 50) | def __setattr__(self, name: str, val: Any) -> None:
    method __getattr__ (line 56) | def __getattr__(self, name: str) -> Any:
    method set (line 61) | def set(self, name: str, value: Any) -> None:
    method has (line 74) | def has(self, name: str) -> bool:
    method remove (line 81) | def remove(self, name: str) -> None:
    method get (line 87) | def get(self, name: str) -> Any:
    method get_fields (line 93) | def get_fields(self) -> Dict[str, Any]:
    method to (line 103) | def to(self, device: str) -> "Instances":
    method __getitem__ (line 115) | def __getitem__(self, item: Union[int, slice, torch.BoolTensor]) -> "I...
    method __len__ (line 129) | def __len__(self) -> int:
    method cat (line 135) | def cat(instance_lists: List["Instances"]) -> "Instances":
    method __str__ (line 166) | def __str__(self) -> str:
    method __repr__ (line 174) | def __repr__(self) -> str:

FILE: detectron2/structures/keypoints.py
  class Keypoints (line 9) | class Keypoints:
    method __init__ (line 21) | def __init__(self, keypoints: Union[torch.Tensor, np.ndarray, List[Lis...
    method __len__ (line 33) | def __len__(self) -> int:
    method to (line 36) | def to(self, *args: Any, **kwargs: Any) -> "Keypoints":
    method to_heatmap (line 39) | def to_heatmap(self, boxes: torch.Tensor, heatmap_size: int) -> torch....
    method __getitem__ (line 53) | def __getitem__(self, item: Union[int, slice, torch.BoolTensor]) -> "K...
    method __repr__ (line 71) | def __repr__(self) -> str:
  function _keypoints_to_heatmap (line 78) | def _keypoints_to_heatmap(
  function heatmaps_to_keypoints (line 138) | def heatmaps_to_keypoints(maps: torch.Tensor, rois: torch.Tensor) -> tor...

FILE: detectron2/structures/masks.py
  function polygon_area (line 16) | def polygon_area(x, y):
  function polygons_to_bitmask (line 22) | def polygons_to_bitmask(polygons: List[np.ndarray], height: int, width: ...
  function rasterize_polygons_within_box (line 39) | def rasterize_polygons_within_box(
  class BitMasks (line 88) | class BitMasks:
    method __init__ (line 97) | def __init__(self, tensor: Union[torch.Tensor, np.ndarray]):
    method to (line 111) | def to(self, *args: Any, **kwargs: Any) -> "BitMasks":
    method device (line 115) | def device(self) -> torch.device:
    method __getitem__ (line 119) | def __getitem__(self, item: Union[int, slice, torch.BoolTensor]) -> "B...
    method __iter__ (line 143) | def __iter__(self) -> torch.Tensor:
    method __repr__ (line 147) | def __repr__(self) -> str:
    method __len__ (line 152) | def __len__(self) -> int:
    method nonempty (line 155) | def nonempty(self) -> torch.Tensor:
    method from_polygon_masks (line 166) | def from_polygon_masks(
    method from_roi_masks (line 183) | def from_roi_masks(roi_masks: "ROIMasks", height: int, width: int) -> ...
    method crop_and_resize (line 191) | def crop_and_resize(self, boxes: torch.Tensor, mask_size: int) -> torc...
    method get_bounding_boxes (line 224) | def get_bounding_boxes(self) -> Boxes:
    method cat (line 243) | def cat(bitmasks_list: List["BitMasks"]) -> "BitMasks":
  class PolygonMasks (line 261) | class PolygonMasks:
    method __init__ (line 269) | def __init__(self, polygons: List[List[Union[torch.Tensor, np.ndarray]...
    method to (line 313) | def to(self, *args: Any, **kwargs: Any) -> "PolygonMasks":
    method device (line 317) | def device(self) -> torch.device:
    method get_bounding_boxes (line 320) | def get_bounding_boxes(self) -> Boxes:
    method nonempty (line 337) | def nonempty(self) -> torch.Tensor:
    method __getitem__ (line 348) | def __getitem__(self, item: Union[int, slice, List[int], torch.BoolTen...
    method __iter__ (line 378) | def __iter__(self) -> Iterator[List[np.ndarray]]:
    method __repr__ (line 386) | def __repr__(self) -> str:
    method __len__ (line 391) | def __len__(self) -> int:
    method crop_and_resize (line 394) | def crop_and_resize(self, boxes: torch.Tensor, mask_size: int) -> torc...
    method area (line 426) | def area(self):
    method cat (line 446) | def cat(polymasks_list: List["PolygonMasks"]) -> "PolygonMasks":
  class ROIMasks (line 466) | class ROIMasks:
    method __init__ (line 473) | def __init__(self, tensor: torch.Tensor):
    method to (line 482) | def to(self, device: torch.device) -> "ROIMasks":
    method device (line 486) | def device(self) -> device:
    method __len__ (line 489) | def __len__(self):
    method __getitem__ (line 492) | def __getitem__(self, item) -> "ROIMasks":
    method __repr__ (line 514) | def __repr__(self) -> str:
    method to_bitmasks (line 520) | def to_bitmasks(self, boxes: torch.Tensor, height, width, threshold=0.5):

FILE: detectron2/structures/rotated_boxes.py
  class RotatedBoxes (line 11) | class RotatedBoxes(Boxes):
    method __init__ (line 20) | def __init__(self, tensor: torch.Tensor):
    method clone (line 221) | def clone(self) -> "RotatedBoxes":
    method to (line 230) | def to(self, device: str) -> "RotatedBoxes":
    method area (line 233) | def area(self) -> torch.Tensor:
    method normalize_angles (line 244) | def normalize_angles(self) -> None:
    method clip (line 251) | def clip(self, box_size: Boxes.BoxSizeType, clip_angle_threshold: floa...
    method nonempty (line 301) | def nonempty(self, threshold: int = 0) -> torch.Tensor:
    method __getitem__ (line 316) | def __getitem__(self, item: Union[int, slice, torch.BoolTensor]) -> "R...
    method __len__ (line 339) | def __len__(self) -> int:
    method __repr__ (line 342) | def __repr__(self) -> str:
    method inside_box (line 345) | def inside_box(self, box_size: Boxes.BoxSizeType, boundary_threshold: ...
    method get_centers (line 382) | def get_centers(self) -> torch.Tensor:
    method cat (line 390) | def cat(boxes_list: List["RotatedBoxes"]) -> "RotatedBoxes":  # type: ...
    method device (line 408) | def device(self) -> str:
    method __iter__ (line 411) | def __iter__(self) -> Iterator[torch.Tensor]:
  function pairwise_iou (line 418) | def pairwise_iou(boxes1: RotatedBoxes, boxes2: RotatedBoxes) -> None:

FILE: detectron2/utils/collect_env.py
  function collect_torch_env (line 12) | def collect_torch_env():
  function get_env_module (line 24) | def get_env_module():
  function collect_env_info (line 29) | def collect_env_info():

FILE: detectron2/utils/colormap.py
  function colormap (line 95) | def colormap(rgb=False, maximum=255):
  function random_color (line 111) | def random_color(rgb=False, maximum=255):

FILE: detectron2/utils/comm.py
  function get_world_size (line 21) | def get_world_size() -> int:
  function get_rank (line 29) | def get_rank() -> int:
  function get_local_rank (line 37) | def get_local_rank() -> int:
  function get_local_size (line 50) | def get_local_size() -> int:
  function is_main_process (line 63) | def is_main_process() -> bool:
  function synchronize (line 67) | def synchronize():
  function _get_global_gloo_group (line 83) | def _get_global_gloo_group():
  function _serialize_to_tensor (line 94) | def _serialize_to_tensor(data, group):
  function _pad_to_largest_tensor (line 112) | def _pad_to_largest_tensor(tensor, group):
  function all_gather (line 139) | def all_gather(data, group=None):
  function gather (line 177) | def gather(data, dst=0, group=None):
  function shared_random_seed (line 220) | def shared_random_seed():
  function reduce_dict (line 234) | def reduce_dict(input_dict, average=True):

FILE: detectron2/utils/develop.py
  function create_dummy_class (line 8) | def create_dummy_class(klass, dependency, message=""):
  function create_dummy_func (line 37) | def create_dummy_func(func, dependency, message=""):

FILE: detectron2/utils/env.py
  function seed_all_rng (line 27) | def seed_all_rng(seed=None):
  function _import_file (line 49) | def _import_file(module_name, file_path, make_importable=False):
  function _configure_libraries (line 58) | def _configure_libraries():
  function setup_environment (line 97) | def setup_environment():
  function setup_custom_environment (line 119) | def setup_custom_environment(custom_module):
  function fixup_module_metadata (line 135) | def fixup_module_metadata(module_name, namespace, keys=None):

FILE: detectron2/utils/events.py
  function get_event_storage (line 15) | def get_event_storage():
  class JSONWriter (line 22) | class JSONWriter:
    method __init__ (line 68) | def __init__(self, json_file, window_size=20):
    method write (line 78) | def write(self):
    method __del__ (line 89) | def __del__(self):
  class TensorboardXWriter (line 94) | class TensorboardXWriter:
    method __init__ (line 99) | def __init__(self, log_dir: str, window_size: int = 20, **kwargs):
    method write (line 111) | def write(self):
    method __del__ (line 116) | def __del__(self):
  class CommonMetricPrinter (line 121) | class CommonMetricPrinter:
    method __init__ (line 129) | def __init__(self, max_iter):
    method write (line 138) | def write(self):
  class EventStorage (line 186) | class EventStorage:
    method __init__ (line 193) | def __init__(self, start_iter=0):
    method put_scalar (line 204) | def put_scalar(self, name, value, smoothing_hint=True):
    method put_scalars (line 231) | def put_scalars(self, *, smoothing_hint=True, **kwargs):
    method history (line 242) | def history(self, name):
    method histories (line 252) | def histories(self):
    method latest (line 259) | def latest(self):
    method latest_with_smoothing_hint (line 266) | def latest_with_smoothing_hint(self, window_size=20):
    method smoothing_hints (line 280) | def smoothing_hints(self):
    method step (line 288) | def step(self):
    method iter (line 299) | def iter(self):
    method iteration (line 303) | def iteration(self):
    method __enter__ (line 307) | def __enter__(self):
    method __exit__ (line 311) | def __exit__(self, exc_type, exc_val, exc_tb):
    method name_scope (line 316) | def name_scope(self, name):

FILE: detectron2/utils/logger.py
  class _ColorfulFormatter (line 12) | class _ColorfulFormatter(logging.Formatter):
    method __init__ (line 13) | def __init__(self, *args, **kwargs):
    method formatMessage (line 20) | def formatMessage(self, record):
  function setup_logger (line 33) | def setup_logger(
  function _cached_log_stream (line 94) | def _cached_log_stream(filename):
  function _find_caller (line 105) | def _find_caller():
  function log_first_n (line 125) | def log_first_n(lvl, msg, n=1, *, name=None, key="caller"):
  function log_every_n (line 160) | def log_every_n(lvl, msg, n=1, *, name=None):
  function create_small_table (line 176) | def create_small_table(small_dict):

FILE: detectron2/utils/memory.py
  function _ignore_torch_cuda_oom (line 12) | def _ignore_torch_cuda_oom():
  function retry_if_cuda_oom (line 26) | def retry_if_cuda_oom(func):

FILE: detectron2/utils/registry.py
  class Registry (line 2) | class Registry(object):
    method __init__ (line 27) | def __init__(self, name):
    method _do_register (line 36) | def _do_register(self, name, obj):
    method register (line 42) | def register(self, obj=None):
    method get (line 60) | def get(self, name):

FILE: detectron2/utils/serialize.py
  class PicklableWrapper (line 5) | class PicklableWrapper(object):
    method __init__ (line 15) | def __init__(self, obj):
    method __reduce__ (line 18) | def __reduce__(self):
    method __call__ (line 22) | def __call__(self, *args, **kwargs):
    method __getattr__ (line 25) | def __getattr__(self, attr):

FILE: detectron2/utils/video_visualizer.py
  class _DetectedInstance (line 15) | class _DetectedInstance:
    method __init__ (line 31) | def __init__(self, label, bbox, mask_rle, color, ttl):
  class VideoVisualizer (line 39) | class VideoVisualizer:
    method __init__ (line 40) | def __init__(self, metadata, instance_mode=ColorMode.IMAGE):
    method draw_instance_predictions (line 53) | def draw_instance_predictions(self, frame, predictions):
    method draw_sem_seg (line 112) | def draw_sem_seg(self, frame, sem_seg, area_threshold=None):
    method draw_panoptic_seg_predictions (line 124) | def draw_panoptic_seg_predictions(
    method _assign_colors (line 180) | def _assign_colors(self, instances):

FILE: detectron2/utils/visualizer.py
  class ColorMode (line 30) | class ColorMode(Enum):
  class GenericMask (line 46) | class GenericMask:
    method __init__ (line 54) | def __init__(self, mask_or_polygons, height, width):
    method mask (line 83) | def mask(self):
    method polygons (line 89) | def polygons(self):
    method has_holes (line 95) | def has_holes(self):
    method mask_to_polygons (line 103) | def mask_to_polygons(self, mask):
    method polygons_to_mask (line 121) | def polygons_to_mask(self, polygons):
    method area (line 126) | def area(self):
    method bbox (line 129) | def bbox(self):
  class _PanopticPrediction (line 138) | class _PanopticPrediction:
    method __init__ (line 139) | def __init__(self, panoptic_seg, segments_info):
    method non_empty_mask (line 152) | def non_empty_mask(self):
    method semantic_masks (line 168) | def semantic_masks(self):
    method instance_masks (line 176) | def instance_masks(self):
  function _create_text_labels (line 186) | def _create_text_labels(classes, scores, class_names):
  class VisImage (line 208) | class VisImage:
    method __init__ (line 209) | def __init__(self, img, scale=1.0):
    method _setup_figure (line 220) | def _setup_figure(self, img):
    method save (line 247) | def save(self, filepath):
    method get_image (line 255) | def get_image(self):
  class Visualizer (line 292) | class Visualizer:
    method __init__ (line 293) | def __init__(self, img_rgb, metadata, scale=1.0, instance_mode=ColorMo...
    method draw_instance_predictions (line 315) | def draw_instance_predictions(self, predictions,is_ass= False, labels_...
    method draw_sem_seg (line 370) | def draw_sem_seg(self, sem_seg, area_threshold=None, alpha=0.8):
    method draw_panoptic_seg_predictions (line 405) | def draw_panoptic_seg_predictions(
    method draw_dataset_dict (line 465) | def draw_dataset_dict(self, dic):
    method overlay_instances (line 502) | def overlay_instances(
    method draw_and_connect_keypoints (line 639) | def draw_and_connect_keypoints(self, keypoints):
    method draw_text (line 698) | def draw_text(
    method draw_box (line 736) | def draw_box(self, box_coord, alpha=0.5, edge_color="g", line_style="-"):
    method draw_circle (line 770) | def draw_circle(self, circle_coord, color, radius=3):
    method draw_line (line 788) | def draw_line(self, x_data, y_data, color):
    method draw_binary_mask (line 807) | def draw_binary_mask(
    method draw_polygon (line 867) | def draw_polygon(self, segment, color, edge_color=None, alpha=0.5):
    method _jitter (line 903) | def _jitter(self, color):
    method _create_grayscale_image (line 922) | def _create_grayscale_image(self, mask=None):
    method _change_color_brightness (line 933) | def _change_color_brightness(self, color, brightness_factor):
    method _convert_boxes (line 958) | def _convert_boxes(self, boxes):
    method _convert_masks (line 967) | def _convert_masks(self, masks_or_polygons):
    method _convert_keypoints (line 990) | def _convert_keypoints(self, keypoints):
    method get_output (line 996) | def get_output(self):

FILE: docs/conf.py
  function autodoc_skip_member (line 258) | def autodoc_skip_member(app, what, name, obj, skip, options):
  function url_resolver (line 268) | def url_resolver(url):
  function setup (line 279) | def setup(app):

FILE: projects/LISA/LISA/LISA_meta_arch.py
  class LISARCNN (line 19) | class LISARCNN(GeneralizedRCNN):
    method __init__ (line 21) | def __init__(self,cfg):
    method forward (line 26) | def forward(self, batched_inputs):
    method inference (line 61) | def inference(self, batched_inputs, detected_instances=None, do_postpr...

FILE: projects/LISA/LISA/LISA_rcnn.py
  class LISAROIHeads (line 24) | class LISAROIHeads(StandardROIHeads):
    method _init_box_head (line 35) | def _init_box_head(self,cfg):
    method forward (line 71) | def forward(self,images, features, association_proposals, proposals, a...
    method _forward_association_box (line 102) | def _forward_association_box(self, features, association_proposals):
    method label_and_sample_proposals (line 128) | def label_and_sample_proposals(self, proposals, targets, isassociation...

FILE: projects/LISA/LISA/LISA_rpn.py
  function build_rpn_head (line 25) | def build_rpn_head(cfg, input_shape,shadow_object_part=False):
  class LISARPNHead (line 34) | class LISARPNHead(StandardRPNHead):
    method __init__ (line 35) | def __init__(self, cfg, input_shape: List[ShapeSpec], shadow_object_pa...
    method forward (line 47) | def forward(self, features):
  function build_proposal_generator (line 70) | def build_proposal_generator(cfg, input_shape, **args):
  class LISARPN (line 82) | class LISARPN(RPN):
    method __init__ (line 84) | def __init__(self, cfg, input_shape: Dict[str, ShapeSpec], shadow_obje...
    method forward (line 90) | def forward(self, images, features, gt_instances=None, pre_proposals=N...

FILE: projects/LISA/LISA/config.py
  function add_lisa_config (line 7) | def add_lisa_config(cfg):

FILE: projects/LISA/defaults.py
  function default_argument_parser (line 48) | def default_argument_parser():
  function default_setup (line 83) | def default_setup(cfg, args):
  class DefaultPredictor (line 132) | class DefaultPredictor:
    method __init__ (line 142) | def __init__(self, cfg):
    method __call__ (line 159) | def __call__(self, original_image):
  class DefaultTrainer (line 180) | class DefaultTrainer(SimpleTrainer):
    method __init__ (line 209) | def __init__(self, cfg):
    method resume_or_load (line 243) | def resume_or_load(self, resume=True):
    method build_hooks (line 261) | def build_hooks(self):
    method build_writers (line 307) | def build_writers(self):
    method train (line 323) | def train(self):
    method build_model (line 336) | def build_model(cls, cfg):
    method build_optimizer (line 347) | def build_optimizer(cls, cfg, model):
    method build_lr_scheduler (line 355) | def build_lr_scheduler(cls, cfg, optimizer):
    method build_train_loader (line 359) | def build_train_loader(cls, cfg):
    method build_test_loader (line 367) | def build_test_loader(cls, cfg, dataset_name):
    method build_evaluator (line 375) | def build_evaluator(cls, cfg, dataset_name):
    method test (line 383) | def test(cls, cfg, model, evaluators=None):

FILE: projects/LISA/demo.py
  function setup_cfg (line 22) | def setup_cfg(args):
  function get_parser (line 35) | def get_parser():

FILE: projects/LISA/predictor.py
  class VisualizationDemo (line 16) | class VisualizationDemo(object):
    method __init__ (line 17) | def __init__(self, cfg, instance_mode=ColorMode.IMAGE, parallel=False):
    method run_on_image (line 36) | def run_on_image(self, image):
    method _frame_from_video (line 76) | def _frame_from_video(self, video):
    method run_on_video (line 84) | def run_on_video(self, video):
  class AsyncPredictor (line 140) | class AsyncPredictor:
    class _StopToken (line 147) | class _StopToken:
    class _PredictWorker (line 150) | class _PredictWorker(mp.Process):
      method __init__ (line 151) | def __init__(self, cfg, task_queue, result_queue):
      method run (line 157) | def run(self):
    method __init__ (line 168) | def __init__(self, cfg, num_gpus: int = 1):
    method put (line 195) | def put(self, image):
    method get (line 199) | def get(self):
    method __len__ (line 215) | def __len__(self):
    method __call__ (line 218) | def __call__(self, image):
    method shutdown (line 222) | def shutdown(self):
    method default_buffer_size (line 227) | def default_buffer_size(self):

FILE: projects/LISA/train_net.py
  class Trainer (line 48) | class Trainer(DefaultTrainer):
    method build_evaluator (line 57) | def build_evaluator(cls, cfg, dataset_name, output_folder=None):
    method test_with_TTA (line 102) | def test_with_TTA(cls, cfg, model):
  function setup (line 119) | def setup(args):
  function main (line 131) | def main(args):

FILE: projects/LISA/utils.py
  function extract_bboxes (line 34) | def extract_bboxes(mask):
  function compute_iou (line 60) | def compute_iou(box, boxes, box_area, boxes_area):
  function compute_overlaps (line 81) | def compute_overlaps(boxes1, boxes2):
  function compute_overlaps_masks (line 100) | def compute_overlaps_masks(masks1, masks2):
  function non_max_suppression (line 122) | def non_max_suppression(boxes, scores, threshold):
  function apply_box_deltas (line 159) | def apply_box_deltas(boxes, deltas):
  function box_refinement (line 209) | def box_refinement(box, gt_box):
  class Dataset (line 239) | class Dataset(object):
    method __init__ (line 255) | def __init__(self, class_map=None):
    method add_class (line 262) | def add_class(self, source, class_id, class_name):
    method add_image (line 276) | def add_image(self, source, image_id, path, **kwargs):
    method image_reference (line 285) | def image_reference(self, image_id):
    method prepare (line 294) | def prepare(self, class_map=None):
    method map_source_class_id (line 330) | def map_source_class_id(self, source_class_id):
    method get_source_class_id (line 338) | def get_source_class_id(self, class_id, source):
    method image_ids (line 345) | def image_ids(self):
    method source_image_link (line 348) | def source_image_link(self, image_id):
    method load_image (line 355) | def load_image(self, image_id):
    method load_mask (line 368) | def load_mask(self, image_id):
  function resize_image (line 388) | def resize_image(image, min_dim=None, max_dim=None, min_scale=None, mode...
  function resize_mask (line 495) | def resize_mask(mask, scale, padding, crop=None):
  function minimize_mask (line 517) | def minimize_mask(bbox, mask, mini_shape):
  function expand_mask (line 537) | def expand_mask(bbox, mini_mask, image_shape):
  function mold_mask (line 556) | def mold_mask(mask, config):
  function unmold_mask (line 560) | def unmold_mask(mask, bbox, image_shape):
  function generate_anchors (line 583) | def generate_anchors(scales, ratios, shape, feature_stride, anchor_stride):
  function generate_pyramid_anchors (line 622) | def generate_pyramid_anchors(scales, ratios, feature_shapes, feature_str...
  function trim_zeros (line 646) | def trim_zeros(x):
  function compute_matches (line 656) | def compute_matches(gt_boxes, gt_class_ids, gt_masks,
  function compute_ap (line 715) | def compute_ap(gt_boxes, gt_class_ids, gt_masks,
  function compute_ap_range (line 754) | def compute_ap_range(gt_box, gt_class_id, gt_mask,
  function compute_recall (line 778) | def compute_recall(pred_boxes, gt_boxes, iou):
  function download_trained_weights (line 840) | def download_trained_weights(coco_model_path, verbose=1):
  function norm_boxes (line 853) | def norm_boxes(boxes, shape):
  function denorm_boxes (line 870) | def denorm_boxes(boxes, shape):
  function resize (line 887) | def resize(image, output_shape, order=1, mode='constant', cval=0, clip=T...
  function __main__ (line 909) | def __main__():

FILE: projects/LISA/visualize_data.py
  function setup (line 18) | def setup(args):
  function parse_args (line 27) | def parse_args(in_args=None):
  function output (line 57) | def output(vis, fname):

FILE: projects/LISA/visualize_json_results.py
  function create_instances (line 24) | def create_instances(ins_predictions, ass_predictions,image_size):
  function dataset_id_map (line 94) | def dataset_id_map(ds_id):
  function dataset_ass_id_map (line 96) | def dataset_ass_id_map(ds_id):
  function dataset_id_map (line 102) | def dataset_id_map(ds_id):

FILE: setup.py
  function get_version (line 17) | def get_version():
  function get_extensions (line 40) | def get_extensions():
  function get_model_zoo_configs (line 89) | def get_model_zoo_configs() -> List[str]:

FILE: tests/test_anchor_generator.py
  class TestAnchorGenerator (line 13) | class TestAnchorGenerator(unittest.TestCase):
    method test_default_anchor_generator (line 14) | def test_default_anchor_generator(self):
    method test_default_anchor_generator_centered (line 45) | def test_default_anchor_generator_centered(self):
    method test_rrpn_anchor_generator (line 77) | def test_rrpn_anchor_generator(self):

FILE: tests/test_box2box_transform.py
  function random_boxes (line 11) | def random_boxes(mean_box, stdev, N):
  class TestBox2BoxTransform (line 15) | class TestBox2BoxTransform(unittest.TestCase):
    method test_reconstruction (line 16) | def test_reconstruction(self):
  function random_rotated_boxes (line 33) | def random_rotated_boxes(mean_box, std_length, std_angle, N):
  class TestBox2BoxTransformRotated (line 39) | class TestBox2BoxTransformRotated(unittest.TestCase):
    method test_reconstruction (line 40) | def test_reconstruction(self):

FILE: tests/test_boxes.py
  class TestBoxMode (line 11) | class TestBoxMode(unittest.TestCase):
    method _convert_xy_to_wh (line 12) | def _convert_xy_to_wh(self, x):
    method _convert_xywha_to_xyxy (line 15) | def _convert_xywha_to_xyxy(self, x):
    method _convert_xywh_to_xywha (line 18) | def _convert_xywh_to_xywha(self, x):
    method test_box_convert_list (line 21) | def test_box_convert_list(self):
    method test_box_convert_array (line 31) | def test_box_convert_array(self):
    method test_box_convert_cpu_tensor (line 39) | def test_box_convert_cpu_tensor(self):
    method test_box_convert_cuda_tensor (line 49) | def test_box_convert_cuda_tensor(self):
    method test_box_convert_xywha_to_xyxy_list (line 59) | def test_box_convert_xywha_to_xyxy_list(self):
    method test_box_convert_xywha_to_xyxy_array (line 69) | def test_box_convert_xywha_to_xyxy_array(self):
    method test_box_convert_xywha_to_xyxy_tensor (line 84) | def test_box_convert_xywha_to_xyxy_tensor(self):
    method test_box_convert_xywh_to_xywha_list (line 100) | def test_box_convert_xywh_to_xywha_list(self):
    method test_box_convert_xywh_to_xywha_array (line 110) | def test_box_convert_xywh_to_xywha_array(self):
    method test_box_convert_xywh_to_xywha_tensor (line 120) | def test_box_convert_xywh_to_xywha_tensor(self):
    method test_json_serializable (line 131) | def test_json_serializable(self):
    method test_json_deserializable (line 138) | def test_json_deserializable(self):
  class TestBoxIOU (line 147) | class TestBoxIOU(unittest.TestCase):
    method test_pairwise_iou (line 148) | def test_pairwise_iou(self):

FILE: tests/test_checkpoint.py
  class TestCheckpointer (line 11) | class TestCheckpointer(unittest.TestCase):
    method setUp (line 12) | def setUp(self):
    method create_complex_model (line 15) | def create_complex_model(self):
    method test_complex_model_loaded (line 32) | def test_complex_model_loaded(self):

FILE: tests/test_config.py
  class TestConfigVersioning (line 24) | class TestConfigVersioning(unittest.TestCase):
    method test_upgrade_downgrade_consistency (line 25) | def test_upgrade_downgrade_consistency(self):
    method _merge_cfg_str (line 34) | def _merge_cfg_str(self, cfg, merge_str):
    method test_auto_upgrade (line 44) | def test_auto_upgrade(self):
    method test_guess_v1 (line 54) | def test_guess_v1(self):

FILE: tests/test_data_loader.py
  class TestTransformAnnotations (line 13) | class TestTransformAnnotations(unittest.TestCase):
    method test_transform_simple_annotation (line 14) | def test_transform_simple_annotation(self):
    method test_flip_keypoints (line 30) | def test_flip_keypoints(self):
    method test_transform_RLE (line 62) | def test_transform_RLE(self):
    method test_transform_RLE_resize (line 85) | def test_transform_RLE_resize(self):
    method test_gen_crop (line 107) | def test_gen_crop(self):
    method test_gen_crop_outside_boxes (line 113) | def test_gen_crop_outside_boxes(self):

FILE: tests/test_data_transform.py
  class TestTransforms (line 16) | class TestTransforms(unittest.TestCase):
    method setUp (line 17) | def setUp(self):
    method test_apply_rotated_boxes (line 20) | def test_apply_rotated_boxes(self):
    method test_apply_rotated_boxes_unequal_scaling_factor (line 38) | def test_apply_rotated_boxes_unequal_scaling_factor(self):
    method test_print_transform_gen (line 72) | def test_print_transform_gen(self):

FILE: tests/test_fast_rcnn.py
  class FastRCNNTest (line 16) | class FastRCNNTest(unittest.TestCase):
    method test_fast_rcnn (line 17) | def test_fast_rcnn(self):
    method test_fast_rcnn_rotated (line 56) | def test_fast_rcnn_rotated(self):

FILE: tests/test_mask_ops.py
  function iou_between_full_image_bit_masks (line 28) | def iou_between_full_image_bit_masks(a, b):
  function rasterize_polygons_with_grid_sample (line 34) | def rasterize_polygons_with_grid_sample(full_image_bit_mask, box, mask_s...
  class TestMaskCropPaste (line 59) | class TestMaskCropPaste(unittest.TestCase):
    method setUp (line 60) | def setUp(self):
    method test_crop_paste_consistency (line 67) | def test_crop_paste_consistency(self):
    method process_annotation (line 99) | def process_annotation(self, ann, mask_side_len=28):
    method test_polygon_area (line 139) | def test_polygon_area(self):
  function benchmark_paste (line 155) | def benchmark_paste():

FILE: tests/test_model_e2e.py
  function get_model_zoo (line 14) | def get_model_zoo(config_path):
  function create_model_input (line 26) | def create_model_input(img, inst=None):
  function get_empty_instance (line 33) | def get_empty_instance(h, w):
  function get_regular_bitmask_instances (line 41) | def get_regular_bitmask_instances(h, w):
  class ModelE2ETest (line 50) | class ModelE2ETest(unittest.TestCase):
    method setUp (line 51) | def setUp(self):
    method _test_eval (line 54) | def _test_eval(self, input_sizes):
    method _test_train (line 59) | def _test_train(self, input_sizes, instances):
  class MaskRCNNE2ETest (line 72) | class MaskRCNNE2ETest(ModelE2ETest):
    method test_empty_data (line 75) | def test_empty_data(self):
    method test_half_empty_data (line 80) | def test_half_empty_data(self):
  class RetinaNetE2ETest (line 85) | class RetinaNetE2ETest(ModelE2ETest):
    method test_empty_data (line 88) | def test_empty_data(self):

FILE: tests/test_model_zoo.py
  class TestModelZoo (line 11) | class TestModelZoo(unittest.TestCase):
    method test_get_returns_model (line 12) | def test_get_returns_model(self):
    method test_get_invalid_model (line 17) | def test_get_invalid_model(self):
    method test_get_url (line 20) | def test_get_url(self):

FILE: tests/test_nms_rotated.py
  class TestNMSRotated (line 10) | class TestNMSRotated(unittest.TestCase):
    method reference_horizontal_nms (line 11) | def reference_horizontal_nms(self, boxes, scores, iou_threshold):
    method _create_tensors (line 35) | def _create_tensors(self, N):
    method test_batched_nms_rotated_0_degree_cpu (line 45) | def test_batched_nms_rotated_0_degree_cpu(self):
    method test_batched_nms_rotated_0_degree_cuda (line 69) | def test_batched_nms_rotated_0_degree_cuda(self):
    method test_nms_rotated_0_degree_cpu (line 92) | def test_nms_rotated_0_degree_cpu(self):
    method test_nms_rotated_90_degrees_cpu (line 106) | def test_nms_rotated_90_degrees_cpu(self):
    method test_nms_rotated_180_degrees_cpu (line 125) | def test_nms_rotated_180_degrees_cpu(self):
    method test_nms_rotated_0_degree_cuda (line 141) | def test_nms_rotated_0_degree_cuda(self):

FILE: tests/test_roi_align.py
  class ROIAlignTest (line 10) | class ROIAlignTest(unittest.TestCase):
    method test_forward_output (line 11) | def test_forward_output(self):
    method test_resize (line 49) | def test_resize(self):
    method _simple_roialign (line 61) | def _simple_roialign(self, img, box, resolution, aligned=True):
    method _simple_roialign_with_grad (line 78) | def _simple_roialign_with_grad(self, img, box, resolution, device):
    method test_empty_box (line 93) | def test_empty_box(self):
    method test_empty_batch (line 105) | def test_empty_batch(self):

FILE: tests/test_roi_align_rotated.py
  class ROIAlignRotatedTest (line 14) | class ROIAlignRotatedTest(unittest.TestCase):
    method _box_to_rotated_box (line 15) | def _box_to_rotated_box(self, box, angle):
    method _rot90 (line 24) | def _rot90(self, img, num):
    method test_forward_output_0_90_180_270 (line 30) | def test_forward_output_0_90_180_270(self):
    method test_resize (line 73) | def test_resize(self):
    method _simple_roi_align_rotated (line 87) | def _simple_roi_align_rotated(self, img, box, resolution):
    method test_empty_box (line 102) | def test_empty_box(self):
    method test_roi_align_rotated_gradcheck_cpu (line 107) | def test_roi_align_rotated_gradcheck_cpu(self):
    method test_roi_align_rotated_gradient_cuda (line 128) | def test_roi_align_rotated_gradient_cuda(self):

FILE: tests/test_roi_heads.py
  class ROIHeadsTest (line 16) | class ROIHeadsTest(unittest.TestCase):
    method test_roi_heads (line 17) | def test_roi_heads(self):
    method test_rroi_heads (line 58) | def test_rroi_heads(self):

FILE: tests/test_roi_pooler.py
  class TestROIPooler (line 12) | class TestROIPooler(unittest.TestCase):
    method _rand_boxes (line 13) | def _rand_boxes(self, num_boxes, x_max, y_max):
    method _test_roialignv2_roialignrotated_match (line 26) | def _test_roialignv2_roialignrotated_match(self, device):
    method test_roialignv2_roialignrotated_match_cpu (line 76) | def test_roialignv2_roialignrotated_match_cpu(self):
    method test_roialignv2_roialignrotated_match_cuda (line 80) | def test_roialignv2_roialignrotated_match_cuda(self):

FILE: tests/test_rotated_boxes.py
  class TestRotatedBoxesLayer (line 17) | class TestRotatedBoxesLayer(unittest.TestCase):
    method test_iou_0_dim_cpu (line 18) | def test_iou_0_dim_cpu(self):
    method test_iou_0_dim_cuda (line 32) | def test_iou_0_dim_cuda(self):
    method test_iou_half_overlap_cpu (line 45) | def test_iou_half_overlap_cpu(self):
    method test_iou_half_overlap_cuda (line 53) | def test_iou_half_overlap_cuda(self):
    method test_iou_0_degree_cpu (line 60) | def test_iou_0_degree_cpu(self):
    method test_iou_0_degree_cuda (line 86) | def test_iou_0_degree_cuda(self):
    method test_iou_45_degrees_cpu (line 111) | def test_iou_45_degrees_cpu(self):
    method test_iou_45_degrees_cuda (line 125) | def test_iou_45_degrees_cuda(self):
    method test_iou_perpendicular_cpu (line 138) | def test_iou_perpendicular_cpu(self):
    method test_iou_perpendicular_cuda (line 147) | def test_iou_perpendicular_cuda(self):
    method test_iou_large_close_boxes_cpu (line 155) | def test_iou_large_close_boxes_cpu(self):
    method test_iou_large_close_boxes_cuda (line 168) | def test_iou_large_close_boxes_cuda(self):
    method test_iou_precision_cpu (line 180) | def test_iou_precision_cpu(self):
    method test_iou_precision_cuda (line 189) | def test_iou_precision_cuda(self):
    method test_iou_many_boxes_cpu (line 197) | def test_iou_many_boxes_cpu(self):
    method test_iou_many_boxes_cuda (line 221) | def test_iou_many_boxes_cuda(self):
    method test_iou_too_many_boxes_cuda (line 245) | def test_iou_too_many_boxes_cuda(self):
  class TestRotatedBoxesStructure (line 253) | class TestRotatedBoxesStructure(unittest.TestCase):
    method test_clip_area_0_degree (line 254) | def test_clip_area_0_degree(self):
    method test_clip_area_arbitrary_angle (line 283) | def test_clip_area_arbitrary_angle(self):
    method test_normalize_angles (line 311) | def test_normalize_angles(self):
    method test_pairwise_iou_0_degree_cpu (line 342) | def test_pairwise_iou_0_degree_cpu(self):
    method test_pairwise_iou_0_degree_cuda (line 373) | def test_pairwise_iou_0_degree_cuda(self):
    method test_pairwise_iou_45_degrees_cpu (line 403) | def test_pairwise_iou_45_degrees_cpu(self):
    method test_pairwise_iou_45_degrees_cuda (line 419) | def test_pairwise_iou_45_degrees_cuda(self):
    method test_pairwise_iou_orthogonal_cpu (line 434) | def test_pairwise_iou_orthogonal_cpu(self):
    method test_pairwise_iou_orthogonal_cuda (line 444) | def test_pairwise_iou_orthogonal_cuda(self):
    method test_pairwise_iou_large_close_boxes_cpu (line 453) | def test_pairwise_iou_large_close_boxes_cpu(self):
    method test_pairwise_iou_large_close_boxes_cuda (line 471) | def test_pairwise_iou_large_close_boxes_cuda(self):
    method test_pairwise_iou_many_boxes_cpu (line 488) | def test_pairwise_iou_many_boxes_cpu(self):
    method test_pairwise_iou_many_boxes_cuda (line 517) | def test_pairwise_iou_many_boxes_cuda(self):
  function benchmark_rotated_iou (line 546) | def benchmark_rotated_iou():

FILE: tests/test_rpn.py
  class RPNTest (line 15) | class RPNTest(unittest.TestCase):
    method test_rpn (line 16) | def test_rpn(self):
    method test_rrpn (line 76) | def test_rrpn(self):

FILE: tests/test_sampler.py
  class TestGroupedBatchSampler (line 8) | class TestGroupedBatchSampler(unittest.TestCase):
    method test_missing_group_id (line 9) | def test_missing_group_id(self):
    method test_groups (line 17) | def test_groups(self):

FILE: tests/test_visualizer.py
  class TestVisualizer (line 14) | class TestVisualizer(unittest.TestCase):
    method _random_data (line 15) | def _random_data(self):
    method metadata (line 34) | def metadata(self):
    method test_draw_dataset_dict (line 37) | def test_draw_dataset_dict(self):
    method test_overlay_instances (line 64) | def test_overlay_instances(self):
    method test_overlay_instances_no_boxes (line 81) | def test_overlay_instances_no_boxes(self):
    method test_draw_instance_predictions (line 86) | def test_draw_instance_predictions(self):
    method test_draw_empty_mask_predictions (line 98) | def test_draw_empty_mask_predictions(self):
    method test_correct_output_shape (line 110) | def test_correct_output_shape(self):
    method test_overlay_rotated_instances (line 116) | def test_overlay_rotated_instances(self):
    method test_draw_no_metadata (line 133) | def test_draw_no_metadata(self):
Condensed preview — 358 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,764K chars).
[
  {
    "path": ".gitignore",
    "chars": 592,
    "preview": "/docker/clipboard.txt\n/projects/LISA/.ipynb_checkpoints/*\n!/projects/LISA/.SOAP.ipynb.icloud\n*/.DS_Store \n.DS_Store\n# ou"
  },
  {
    "path": "LICENSE",
    "chars": 10242,
    "preview": "Apache License\nVersion 2.0, January 2004\nhttp://www.apache.org/licenses/\n\nTERMS AND CONDITIONS FOR USE, REPRODUCTION, AN"
  },
  {
    "path": "PythonAPI/Makefile",
    "chars": 199,
    "preview": "all:\n    # install pycocotools locally\n\tpython setup.py build_ext --inplace\n\trm -rf build\n\ninstall:\n\t# install pycocotoo"
  },
  {
    "path": "PythonAPI/common/gason.cpp",
    "chars": 9540,
    "preview": "// https://github.com/vivkin/gason - pulled January 10, 2016\n#include \"gason.h\"\n#include <stdlib.h>\n\n#define JSON_ZONE_S"
  },
  {
    "path": "PythonAPI/common/gason.h",
    "chars": 3483,
    "preview": "// https://github.com/vivkin/gason - pulled January 10, 2016\n#pragma once\n\n#include <stdint.h>\n#include <stddef.h>\n#incl"
  },
  {
    "path": "PythonAPI/common/maskApi.c",
    "chars": 8308,
    "preview": "/**************************************************************************\n* Microsoft COCO Toolbox.      version 2.0\n*"
  },
  {
    "path": "PythonAPI/common/maskApi.h",
    "chars": 2176,
    "preview": "/**************************************************************************\n* Microsoft COCO Toolbox.      version 2.0\n*"
  },
  {
    "path": "PythonAPI/pysobatools/__init__.py",
    "chars": 21,
    "preview": "__author__ = 'tylin'\n"
  },
  {
    "path": "PythonAPI/pysobatools/_mask.c",
    "chars": 709729,
    "preview": "/* Generated by Cython 0.29.13 */\n\n#define PY_SSIZE_T_CLEAN\n#include \"Python.h\"\n#ifndef Py_PYTHON_H\n    #error Python he"
  },
  {
    "path": "PythonAPI/pysobatools/_mask.pyx",
    "chars": 11440,
    "preview": "# distutils: language = c\n# distutils: sources = ../common/maskApi.c\n\n#*************************************************"
  },
  {
    "path": "PythonAPI/pysobatools/cocoeval.py",
    "chars": 27706,
    "preview": "__author__ = 'tsungyi'\n\nimport numpy as np\nimport datetime\nimport time\nfrom collections import defaultdict\nfrom . import"
  },
  {
    "path": "PythonAPI/pysobatools/mask.py",
    "chars": 4591,
    "preview": "__author__ = 'tsungyi'\n\nimport pysobatools._mask as _mask\n\n# Interface for manipulating masks stored in RLE format.\n#\n# "
  },
  {
    "path": "PythonAPI/pysobatools/soba.py",
    "chars": 25354,
    "preview": "__author__ = 'tylin'\n__version__ = '2.0'\n# Interface for accessing the Microsoft SOBA dataset.\n\n# Microsoft SOBA is a la"
  },
  {
    "path": "PythonAPI/pysobatools/sobaeval.py",
    "chars": 30642,
    "preview": "__author__ = 'tianyu'\n\nimport numpy as np\nimport datetime\nimport time\nfrom collections import defaultdict\nfrom . import "
  },
  {
    "path": "PythonAPI/setup.py",
    "chars": 760,
    "preview": "from setuptools import setup, Extension\nimport numpy as np\n\n# To compile and install locally run \"python setup.py build_"
  },
  {
    "path": "README.md",
    "chars": 3549,
    "preview": "# Instance Shadow Detection (CVPR’ 20)\n\n[Tianyu Wang](https://stevewongv.github.io)\\*, [Xiaowei Hu](https://xw-hu.github"
  },
  {
    "path": "configs/Base-RCNN-C4.yaml",
    "chars": 368,
    "preview": "MODEL:\n  META_ARCHITECTURE: \"GeneralizedRCNN\"\n  RPN:\n    PRE_NMS_TOPK_TEST: 6000\n    POST_NMS_TOPK_TEST: 1000\n  ROI_HEAD"
  },
  {
    "path": "configs/Base-RCNN-DilatedC5.yaml",
    "chars": 665,
    "preview": "MODEL:\n  META_ARCHITECTURE: \"GeneralizedRCNN\"\n  RESNETS:\n    OUT_FEATURES: [\"res5\"]\n    RES5_DILATION: 2\n  RPN:\n    IN_F"
  },
  {
    "path": "configs/Base-RCNN-FPN.yaml",
    "chars": 1318,
    "preview": "MODEL:\n  META_ARCHITECTURE: \"GeneralizedRCNN\"\n  BACKBONE:\n    NAME: \"build_resnet_fpn_backbone\"\n  RESNETS:\n    OUT_FEATU"
  },
  {
    "path": "configs/Base-RetinaNet.yaml",
    "chars": 691,
    "preview": "MODEL:\n  META_ARCHITECTURE: \"RetinaNet\"\n  BACKBONE:\n    NAME: \"build_retinanet_resnet_fpn_backbone\"\n  RESNETS:\n    OUT_F"
  },
  {
    "path": "configs/COCO-Detection/fast_rcnn_R_50_FPN_1x.yaml",
    "chars": 628,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: False\n  LOA"
  },
  {
    "path": "configs/COCO-Detection/faster_rcnn_R_101_C4_3x.yaml",
    "chars": 194,
    "preview": "_BASE_: \"../Base-RCNN-C4.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-101.pkl\"\n  MASK_ON: False\n  RES"
  },
  {
    "path": "configs/COCO-Detection/faster_rcnn_R_101_DC5_3x.yaml",
    "chars": 201,
    "preview": "_BASE_: \"../Base-RCNN-DilatedC5.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-101.pkl\"\n  MASK_ON: Fals"
  },
  {
    "path": "configs/COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml",
    "chars": 195,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-101.pkl\"\n  MASK_ON: False\n  RE"
  },
  {
    "path": "configs/COCO-Detection/faster_rcnn_R_50_C4_1x.yaml",
    "chars": 139,
    "preview": "_BASE_: \"../Base-RCNN-C4.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: False\n  RESN"
  },
  {
    "path": "configs/COCO-Detection/faster_rcnn_R_50_C4_3x.yaml",
    "chars": 192,
    "preview": "_BASE_: \"../Base-RCNN-C4.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: False\n  RESN"
  },
  {
    "path": "configs/COCO-Detection/faster_rcnn_R_50_DC5_1x.yaml",
    "chars": 146,
    "preview": "_BASE_: \"../Base-RCNN-DilatedC5.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: False"
  },
  {
    "path": "configs/COCO-Detection/faster_rcnn_R_50_DC5_3x.yaml",
    "chars": 199,
    "preview": "_BASE_: \"../Base-RCNN-DilatedC5.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: False"
  },
  {
    "path": "configs/COCO-Detection/faster_rcnn_R_50_FPN_1x.yaml",
    "chars": 140,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: False\n  RES"
  },
  {
    "path": "configs/COCO-Detection/faster_rcnn_R_50_FPN_3x.yaml",
    "chars": 193,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: False\n  RES"
  },
  {
    "path": "configs/COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x.yaml",
    "chars": 328,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  MASK_ON: False\n  WEIGHTS: \"detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl"
  },
  {
    "path": "configs/COCO-Detection/retinanet_R_101_FPN_3x.yaml",
    "chars": 179,
    "preview": "_BASE_: \"../Base-RetinaNet.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-101.pkl\"\n  RESNETS:\n    DEPTH"
  },
  {
    "path": "configs/COCO-Detection/retinanet_R_50_FPN_1x.yaml",
    "chars": 124,
    "preview": "_BASE_: \"../Base-RetinaNet.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  RESNETS:\n    DEPTH:"
  },
  {
    "path": "configs/COCO-Detection/retinanet_R_50_FPN_3x.yaml",
    "chars": 177,
    "preview": "_BASE_: \"../Base-RetinaNet.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  RESNETS:\n    DEPTH:"
  },
  {
    "path": "configs/COCO-Detection/rpn_R_50_C4_1x.yaml",
    "chars": 243,
    "preview": "_BASE_: \"../Base-RCNN-C4.yaml\"\nMODEL:\n  META_ARCHITECTURE: \"ProposalNetwork\"\n  WEIGHTS: \"detectron2://ImageNetPretrained"
  },
  {
    "path": "configs/COCO-Detection/rpn_R_50_FPN_1x.yaml",
    "chars": 215,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  META_ARCHITECTURE: \"ProposalNetwork\"\n  WEIGHTS: \"detectron2://ImageNetPretraine"
  },
  {
    "path": "configs/COCO-InstanceSegmentation/mask_rcnn_R_101_C4_3x.yaml",
    "chars": 193,
    "preview": "_BASE_: \"../Base-RCNN-C4.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-101.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/COCO-InstanceSegmentation/mask_rcnn_R_101_DC5_3x.yaml",
    "chars": 200,
    "preview": "_BASE_: \"../Base-RCNN-DilatedC5.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-101.pkl\"\n  MASK_ON: True"
  },
  {
    "path": "configs/COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x.yaml",
    "chars": 194,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-101.pkl\"\n  MASK_ON: True\n  RES"
  },
  {
    "path": "configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_1x.yaml",
    "chars": 138,
    "preview": "_BASE_: \"../Base-RCNN-C4.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESNE"
  },
  {
    "path": "configs/COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x.yaml",
    "chars": 191,
    "preview": "_BASE_: \"../Base-RCNN-C4.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESNE"
  },
  {
    "path": "configs/COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_1x.yaml",
    "chars": 145,
    "preview": "_BASE_: \"../Base-RCNN-DilatedC5.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n"
  },
  {
    "path": "configs/COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x.yaml",
    "chars": 198,
    "preview": "_BASE_: \"../Base-RCNN-DilatedC5.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n"
  },
  {
    "path": "configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml",
    "chars": 139,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml",
    "chars": 192,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x.yaml",
    "chars": 327,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  MASK_ON: True\n  WEIGHTS: \"detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl\""
  },
  {
    "path": "configs/COCO-Keypoints/Base-Keypoint-RCNN-FPN.yaml",
    "chars": 527,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  KEYPOINT_ON: True\n  ROI_HEADS:\n    NUM_CLASSES: 1\n  ROI_BOX_HEAD:\n    SMOOTH_L1"
  },
  {
    "path": "configs/COCO-Keypoints/keypoint_rcnn_R_101_FPN_3x.yaml",
    "chars": 184,
    "preview": "_BASE_: \"Base-Keypoint-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-101.pkl\"\n  RESNETS:\n    "
  },
  {
    "path": "configs/COCO-Keypoints/keypoint_rcnn_R_50_FPN_1x.yaml",
    "chars": 129,
    "preview": "_BASE_: \"Base-Keypoint-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  RESNETS:\n    D"
  },
  {
    "path": "configs/COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml",
    "chars": 182,
    "preview": "_BASE_: \"Base-Keypoint-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  RESNETS:\n    D"
  },
  {
    "path": "configs/COCO-Keypoints/keypoint_rcnn_X_101_32x8d_FPN_3x.yaml",
    "chars": 317,
    "preview": "_BASE_: \"Base-Keypoint-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl\"\n  PIXEL_S"
  },
  {
    "path": "configs/COCO-PanopticSegmentation/Base-Panoptic-FPN.yaml",
    "chars": 232,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  META_ARCHITECTURE: \"PanopticFPN\"\n  MASK_ON: True\n  SEM_SEG_HEAD:\n    LOSS_WEIGH"
  },
  {
    "path": "configs/COCO-PanopticSegmentation/panoptic_fpn_R_101_3x.yaml",
    "chars": 179,
    "preview": "_BASE_: \"Base-Panoptic-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-101.pkl\"\n  RESNETS:\n    DEPTH"
  },
  {
    "path": "configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_1x.yaml",
    "chars": 124,
    "preview": "_BASE_: \"Base-Panoptic-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  RESNETS:\n    DEPTH:"
  },
  {
    "path": "configs/COCO-PanopticSegmentation/panoptic_fpn_R_50_3x.yaml",
    "chars": 177,
    "preview": "_BASE_: \"Base-Panoptic-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  RESNETS:\n    DEPTH:"
  },
  {
    "path": "configs/Cityscapes/mask_rcnn_R_50_FPN.yaml",
    "chars": 889,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  # WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  # For better, more"
  },
  {
    "path": "configs/Detectron1-Comparisons/README.md",
    "chars": 3959,
    "preview": "\nDetectron2's default settings and a few implementation details are different from Detectron.\n\nThe differences in implem"
  },
  {
    "path": "configs/Detectron1-Comparisons/faster_rcnn_R_50_FPN_noaug_1x.yaml",
    "chars": 449,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: False\n  RES"
  },
  {
    "path": "configs/Detectron1-Comparisons/keypoint_rcnn_R_50_FPN_1x.yaml",
    "chars": 843,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  KEYPOINT_ON: True\n  "
  },
  {
    "path": "configs/Detectron1-Comparisons/mask_rcnn_R_50_FPN_noaug_1x.yaml",
    "chars": 522,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/LVIS-InstanceSegmentation/mask_rcnn_R_101_FPN_1x.yaml",
    "chars": 473,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-101.pkl\"\n  MASK_ON: True\n  RES"
  },
  {
    "path": "configs/LVIS-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml",
    "chars": 471,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/LVIS-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_1x.yaml",
    "chars": 606,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl\"\n  PIXEL_STD: [5"
  },
  {
    "path": "configs/Misc/cascade_mask_rcnn_R_50_FPN_1x.yaml",
    "chars": 263,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/Misc/cascade_mask_rcnn_R_50_FPN_3x.yaml",
    "chars": 316,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/Misc/cascade_mask_rcnn_X_152_32x8d_FPN_IN5k_gn_dconv.yaml",
    "chars": 768,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  MASK_ON: True\n  WEIGHTS: \"catalog://ImageNetPretrained/FAIR/X-152-32x8d-IN5k\"\n "
  },
  {
    "path": "configs/Misc/mask_rcnn_R_50_FPN_1x_cls_agnostic.yaml",
    "chars": 232,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/Misc/mask_rcnn_R_50_FPN_1x_dconv_c3-c5.yaml",
    "chars": 238,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/Misc/mask_rcnn_R_50_FPN_3x_dconv_c3-c5.yaml",
    "chars": 291,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/Misc/mask_rcnn_R_50_FPN_3x_gn.yaml",
    "chars": 390,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"catalog://ImageNetPretrained/FAIR/R-50-GN\"\n  MASK_ON: True\n  RESNETS:"
  },
  {
    "path": "configs/Misc/mask_rcnn_R_50_FPN_3x_syncbn.yaml",
    "chars": 448,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\n  RESN"
  },
  {
    "path": "configs/Misc/panoptic_fpn_R_101_dconv_cascade_gn_3x.yaml",
    "chars": 649,
    "preview": "# A large PanopticFPN for demo purposes.\n# Use GN on backbone to support semantic seg.\n# Use Cascade + Deform Conv to im"
  },
  {
    "path": "configs/Misc/scratch_mask_rcnn_R_50_FPN_3x_gn.yaml",
    "chars": 525,
    "preview": "_BASE_: \"mask_rcnn_R_50_FPN_3x_gn.yaml\"\n# INPUT:\n  # It makes sense to divide by STD when training from scratch\n  # But "
  },
  {
    "path": "configs/Misc/semantic_R_50_FPN_1x.yaml",
    "chars": 325,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  META_ARCHITECTURE: \"SemanticSegmentor\"\n  WEIGHTS: \"detectron2://ImageNetPretrai"
  },
  {
    "path": "configs/PascalVOC-Detection/faster_rcnn_R_50_C4.yaml",
    "chars": 448,
    "preview": "_BASE_: \"../Base-RCNN-C4.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: False\n  RESN"
  },
  {
    "path": "configs/PascalVOC-Detection/faster_rcnn_R_50_FPN.yaml",
    "chars": 449,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: False\n  RES"
  },
  {
    "path": "configs/quick_schedules/README.md",
    "chars": 82,
    "preview": "These are quick configs for performance or accuracy regression tracking purposes.\n"
  },
  {
    "path": "configs/quick_schedules/fast_rcnn_R_50_FPN_inference_acc_test.yaml",
    "chars": 255,
    "preview": "_BASE_: \"../COCO-Detection/fast_rcnn_R_50_FPN_1x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://COCO-Detection/fast_rcnn_R_50_FPN"
  },
  {
    "path": "configs/quick_schedules/fast_rcnn_R_50_FPN_instant_test.yaml",
    "chars": 542,
    "preview": "_BASE_: \"../COCO-Detection/fast_rcnn_R_50_FPN_1x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\""
  },
  {
    "path": "configs/quick_schedules/keypoint_rcnn_R_50_FPN_inference_acc_test.yaml",
    "chars": 307,
    "preview": "_BASE_: \"../COCO-Keypoints/keypoint_rcnn_R_50_FPN_3x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://COCO-Keypoints/keypoint_rcnn_"
  },
  {
    "path": "configs/quick_schedules/keypoint_rcnn_R_50_FPN_instant_test.yaml",
    "chars": 314,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  KEYPOINT_ON: True\nDA"
  },
  {
    "path": "configs/quick_schedules/keypoint_rcnn_R_50_FPN_normalized_training_acc_test.yaml",
    "chars": 842,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  KEYPOINT_ON: True\n  "
  },
  {
    "path": "configs/quick_schedules/keypoint_rcnn_R_50_FPN_training_acc_test.yaml",
    "chars": 772,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  KEYPOINT_ON: True\n  "
  },
  {
    "path": "configs/quick_schedules/mask_rcnn_R_50_C4_inference_acc_test.yaml",
    "chars": 304,
    "preview": "_BASE_: \"../COCO-InstanceSegmentation/mask_rcnn_R_50_C4_3x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://COCO-InstanceSegmentati"
  },
  {
    "path": "configs/quick_schedules/mask_rcnn_R_50_C4_instant_test.yaml",
    "chars": 289,
    "preview": "_BASE_: \"../Base-RCNN-C4.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\nDATASET"
  },
  {
    "path": "configs/quick_schedules/mask_rcnn_R_50_C4_training_acc_test.yaml",
    "chars": 532,
    "preview": "_BASE_: \"../Base-RCNN-C4.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  ROI_HEADS:\n    BATCH_"
  },
  {
    "path": "configs/quick_schedules/mask_rcnn_R_50_DC5_inference_acc_test.yaml",
    "chars": 306,
    "preview": "_BASE_: \"../COCO-InstanceSegmentation/mask_rcnn_R_50_DC5_3x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://COCO-InstanceSegmentat"
  },
  {
    "path": "configs/quick_schedules/mask_rcnn_R_50_FPN_inference_acc_test.yaml",
    "chars": 465,
    "preview": "_BASE_: \"../COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://COCO-InstanceSegmentat"
  },
  {
    "path": "configs/quick_schedules/mask_rcnn_R_50_FPN_instant_test.yaml",
    "chars": 290,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  MASK_ON: True\nDATASE"
  },
  {
    "path": "configs/quick_schedules/mask_rcnn_R_50_FPN_training_acc_test.yaml",
    "chars": 496,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\n  ROI_HEADS:\n    BATCH"
  },
  {
    "path": "configs/quick_schedules/panoptic_fpn_R_50_inference_acc_test.yaml",
    "chars": 394,
    "preview": "_BASE_: \"../COCO-PanopticSegmentation/panoptic_fpn_R_50_3x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://COCO-PanopticSegmentati"
  },
  {
    "path": "configs/quick_schedules/panoptic_fpn_R_50_instant_test.yaml",
    "chars": 425,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  META_ARCHITECTURE: \"PanopticFPN\"\n  WEIGHTS: \"detectron2://ImageNetPretrained/MS"
  },
  {
    "path": "configs/quick_schedules/panoptic_fpn_R_50_training_acc_test.yaml",
    "chars": 567,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  META_ARCHITECTURE: \"PanopticFPN\"\n  WEIGHTS: \"detectron2://ImageNetPretrained/MS"
  },
  {
    "path": "configs/quick_schedules/retinanet_R_50_FPN_inference_acc_test.yaml",
    "chars": 255,
    "preview": "_BASE_: \"../COCO-Detection/retinanet_R_50_FPN_3x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://COCO-Detection/retinanet_R_50_FPN"
  },
  {
    "path": "configs/quick_schedules/retinanet_R_50_FPN_instant_test.yaml",
    "chars": 297,
    "preview": "_BASE_: \"../COCO-Detection/retinanet_R_50_FPN_1x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\""
  },
  {
    "path": "configs/quick_schedules/rpn_R_50_FPN_inference_acc_test.yaml",
    "chars": 257,
    "preview": "_BASE_: \"../COCO-Detection/rpn_R_50_FPN_1x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://COCO-Detection/rpn_R_50_FPN_1x/13725849"
  },
  {
    "path": "configs/quick_schedules/rpn_R_50_FPN_instant_test.yaml",
    "chars": 291,
    "preview": "_BASE_: \"../COCO-Detection/rpn_R_50_FPN_1x.yaml\"\nMODEL:\n  WEIGHTS: \"detectron2://ImageNetPretrained/MSRA/R-50.pkl\"\nDATAS"
  },
  {
    "path": "configs/quick_schedules/semantic_R_50_FPN_inference_acc_test.yaml",
    "chars": 366,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  META_ARCHITECTURE: \"SemanticSegmentor\"\n  WEIGHTS: \"detectron2://semantic_R_50_F"
  },
  {
    "path": "configs/quick_schedules/semantic_R_50_FPN_instant_test.yaml",
    "chars": 434,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  META_ARCHITECTURE: \"SemanticSegmentor\"\n  WEIGHTS: \"detectron2://ImageNetPretrai"
  },
  {
    "path": "configs/quick_schedules/semantic_R_50_FPN_training_acc_test.yaml",
    "chars": 520,
    "preview": "_BASE_: \"../Base-RCNN-FPN.yaml\"\nMODEL:\n  META_ARCHITECTURE: \"SemanticSegmentor\"\n  WEIGHTS: \"detectron2://ImageNetPretrai"
  },
  {
    "path": "datasets/README.md",
    "chars": 2108,
    "preview": "\nFor a few datasets that detectron2 natively supports,\nthe datasets are assumed to exist in a directory called\n\"datasets"
  },
  {
    "path": "datasets/prepare_for_tests.sh",
    "chars": 528,
    "preview": "#!/bin/bash -e\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\n# Download some files needed for "
  },
  {
    "path": "datasets/prepare_panoptic_fpn.py",
    "chars": 4330,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport time\nimport funct"
  },
  {
    "path": "demo/README.md",
    "chars": 326,
    "preview": "\n## Detectron2 Demo\n\nWe provide a command line tool to run a simple demo of builtin models.\nThe usage is explained in [G"
  },
  {
    "path": "demo/demo.py",
    "chars": 5689,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport argparse\nimport glob\nimport multiprocessin"
  },
  {
    "path": "demo/predictor.py",
    "chars": 7851,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport atexit\nimport bisect\nimport multiprocessin"
  },
  {
    "path": "detectron2/__init__.py",
    "chars": 157,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n\nfrom .utils.env import setup_environment\n\nsetup"
  },
  {
    "path": "detectron2/checkpoint/__init__.py",
    "chars": 369,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n# File:\n\n\nfrom . import m"
  },
  {
    "path": "detectron2/checkpoint/c2_model_loading.py",
    "chars": 14802,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport copy\nimport logging\nimport re\nimport torch"
  },
  {
    "path": "detectron2/checkpoint/catalog.py",
    "chars": 6145,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport logging\nfrom fvcore.common.file_io import "
  },
  {
    "path": "detectron2/checkpoint/detection_checkpoint.py",
    "chars": 2456,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport pickle\nfrom fvcore.common.checkpoint impor"
  },
  {
    "path": "detectron2/checkpoint/model_zoo.py",
    "chars": 6105,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport logging\nfrom fvcore.common.file_io import "
  },
  {
    "path": "detectron2/config/__init__.py",
    "chars": 320,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom .compat import downgrade_config, upgrade_con"
  },
  {
    "path": "detectron2/config/compat.py",
    "chars": 7910,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\"\"\"\nBackward compatibility of configs.\n\nInstructi"
  },
  {
    "path": "detectron2/config/config.py",
    "chars": 3235,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport logging\nfrom fvco"
  },
  {
    "path": "detectron2/config/defaults.py",
    "chars": 24556,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom .config import CfgNode as CN\n\n# ------------"
  },
  {
    "path": "detectron2/data/__init__.py",
    "chars": 606,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom . import transforms  # isort:skip\n\nfrom .bui"
  },
  {
    "path": "detectron2/data/build.py",
    "chars": 15713,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport bisect\nimport copy\nimport itertools\nimport"
  },
  {
    "path": "detectron2/data/catalog.py",
    "chars": 6522,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport copy\nimport logging\nimport types\nfrom typi"
  },
  {
    "path": "detectron2/data/common.py",
    "chars": 2544,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport copy\nimport logging\nimport random\nimport t"
  },
  {
    "path": "detectron2/data/dataset_mapper.py",
    "chars": 6586,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport copy\nimport numpy as np\nimport torch\nfrom "
  },
  {
    "path": "detectron2/data/dataset_mapper.py.bak",
    "chars": 6038,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport copy\nimport numpy as np\nimport torch\nfrom "
  },
  {
    "path": "detectron2/data/datasets/README.md",
    "chars": 347,
    "preview": "\n\n### Common Datasets\n\nThe dataset implemented here do not need to load the data into the final format.\nIt should provid"
  },
  {
    "path": "detectron2/data/datasets/__init__.py",
    "chars": 460,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom .cityscapes import load_cityscapes_instances"
  },
  {
    "path": "detectron2/data/datasets/builtin.py",
    "chars": 8120,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\n\n\"\"\"\nThis file registers"
  },
  {
    "path": "detectron2/data/datasets/builtin_meta.py",
    "chars": 15021,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\n\n# All coco categories, "
  },
  {
    "path": "detectron2/data/datasets/cityscapes.py",
    "chars": 12751,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport functools\nimport glob\nimport json\nimport l"
  },
  {
    "path": "detectron2/data/datasets/coco.py",
    "chars": 15821,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport io\nimport logging\nimport contextlib\nimport"
  },
  {
    "path": "detectron2/data/datasets/lvis.py",
    "chars": 7762,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport logging\nimport os\n\nfrom fvcore.common.time"
  },
  {
    "path": "detectron2/data/datasets/lvis_v0_5_categories.py",
    "chars": 223777,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n# Autogen with\n# with open(\"lvis_v0.5_val.json\", "
  },
  {
    "path": "detectron2/data/datasets/pascal_voc.py",
    "chars": 2745,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nfrom fvcore.common.file_"
  },
  {
    "path": "detectron2/data/datasets/register_coco.py",
    "chars": 5165,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport copy\n\nfrom detectron2.data import DatasetC"
  },
  {
    "path": "detectron2/data/datasets/register_soba.py",
    "chars": 5165,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport copy\n\nfrom detectron2.data import DatasetC"
  },
  {
    "path": "detectron2/data/datasets/soba.py",
    "chars": 15821,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport io\nimport logging\nimport contextlib\nimport"
  },
  {
    "path": "detectron2/data/detection_utils.py",
    "chars": 16790,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\n\"\"\"\nCommon data processi"
  },
  {
    "path": "detectron2/data/samplers/__init__.py",
    "chars": 346,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom .distributed_sampler import InferenceSampler"
  },
  {
    "path": "detectron2/data/samplers/distributed_sampler.py",
    "chars": 7925,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport itertools\nimport math\nfrom collections imp"
  },
  {
    "path": "detectron2/data/samplers/grouped_batch_sampler.py",
    "chars": 2020,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport torch\nfrom torch.utils.data.sampler import"
  },
  {
    "path": "detectron2/data/transforms/__init__.py",
    "chars": 233,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom .transform import *\nfrom fvcore.transforms.t"
  },
  {
    "path": "detectron2/data/transforms/transform.py",
    "chars": 7238,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n# File: transform.py\n\nimp"
  },
  {
    "path": "detectron2/data/transforms/transform_gen.py",
    "chars": 15174,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n# File: transformer.py\n\ni"
  },
  {
    "path": "detectron2/engine/__init__.py",
    "chars": 361,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n\nfrom .launch import *\nfrom .train_loop import *"
  },
  {
    "path": "detectron2/engine/defaults.py",
    "chars": 15868,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\n\"\"\"\nThis file contains c"
  },
  {
    "path": "detectron2/engine/hooks.py",
    "chars": 14195,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport datetime\nimport l"
  },
  {
    "path": "detectron2/engine/launch.py",
    "chars": 3141,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport logging\nimport torch\nimport torch.distribu"
  },
  {
    "path": "detectron2/engine/train_loop.py",
    "chars": 8869,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport logging\nimport nu"
  },
  {
    "path": "detectron2/evaluation/__init__.py",
    "chars": 598,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom .cityscapes_evaluation import CityscapesEval"
  },
  {
    "path": "detectron2/evaluation/cityscapes_evaluation.py",
    "chars": 4782,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport glob\nimport logging\nimport os\nimport tempf"
  },
  {
    "path": "detectron2/evaluation/coco_evaluation.py",
    "chars": 22734,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport contextlib\nimport copy\nimport io\nimport it"
  },
  {
    "path": "detectron2/evaluation/evaluation/__init__.py",
    "chars": 598,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom .cityscapes_evaluation import CityscapesEval"
  },
  {
    "path": "detectron2/evaluation/evaluation/cityscapes_evaluation.py",
    "chars": 4782,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport glob\nimport logging\nimport os\nimport tempf"
  },
  {
    "path": "detectron2/evaluation/evaluation/coco_evaluation.py",
    "chars": 22734,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport contextlib\nimport copy\nimport io\nimport it"
  },
  {
    "path": "detectron2/evaluation/evaluation/evaluator.py",
    "chars": 5461,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport datetime\nimport logging\nimport time\nfrom c"
  },
  {
    "path": "detectron2/evaluation/evaluation/lvis_evaluation.py",
    "chars": 14237,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport copy\nimport itertools\nimport json\nimport l"
  },
  {
    "path": "detectron2/evaluation/evaluation/panoptic_evaluation.py",
    "chars": 6156,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport contextlib\nimport io\nimport itertools\nimpo"
  },
  {
    "path": "detectron2/evaluation/evaluation/pascal_voc_evaluation.py",
    "chars": 10459,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport logging\nimport nu"
  },
  {
    "path": "detectron2/evaluation/evaluation/sem_seg_evaluation.py",
    "chars": 6781,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport itertools\nimport json\nimport logging\nimpor"
  },
  {
    "path": "detectron2/evaluation/evaluation/testing.py",
    "chars": 2379,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport logging\nimport numpy as np\nimport pprint\ni"
  },
  {
    "path": "detectron2/evaluation/evaluator.py",
    "chars": 5473,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport datetime\nimport logging\nimport time\nfrom c"
  },
  {
    "path": "detectron2/evaluation/lvis_evaluation.py",
    "chars": 14237,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport copy\nimport itertools\nimport json\nimport l"
  },
  {
    "path": "detectron2/evaluation/panoptic_evaluation.py",
    "chars": 6156,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport contextlib\nimport io\nimport itertools\nimpo"
  },
  {
    "path": "detectron2/evaluation/pascal_voc_evaluation.py",
    "chars": 10459,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport logging\nimport nu"
  },
  {
    "path": "detectron2/evaluation/rotated_coco_evaluation.py",
    "chars": 7531,
    "preview": "import itertools\nimport json\nimport numpy as np\nimport os\nimport torch\nfrom fvcore.common.file_io import PathManager\nfro"
  },
  {
    "path": "detectron2/evaluation/sem_seg_evaluation.py",
    "chars": 6781,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport itertools\nimport json\nimport logging\nimpor"
  },
  {
    "path": "detectron2/evaluation/soba_evaluation.py",
    "chars": 22734,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport contextlib\nimport copy\nimport io\nimport it"
  },
  {
    "path": "detectron2/evaluation/testing.py",
    "chars": 2379,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport logging\nimport numpy as np\nimport pprint\ni"
  },
  {
    "path": "detectron2/export/README.md",
    "chars": 364,
    "preview": "\nThis directory contains code to prepare a detectron2 model for deployment.\nCurrently it supports exporting a detectron2"
  },
  {
    "path": "detectron2/export/__init__.py",
    "chars": 110,
    "preview": "# -*- coding: utf-8 -*-\n\nfrom .api import *\n\n__all__ = [k for k in globals().keys() if not k.startswith(\"_\")]\n"
  },
  {
    "path": "detectron2/export/api.py",
    "chars": 5309,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\nimport logging\nimport os\nfrom caffe2.proto impor"
  },
  {
    "path": "detectron2/export/c10.py",
    "chars": 18649,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n\nimport math\nimport torch\nimport torch.nn.functi"
  },
  {
    "path": "detectron2/export/caffe2_export.py",
    "chars": 7455,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport copy\nimport io\nimport logging\nimport nump"
  },
  {
    "path": "detectron2/export/caffe2_inference.py",
    "chars": 5845,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport collections\nimport logging\nimport numpy a"
  },
  {
    "path": "detectron2/export/caffe2_modeling.py",
    "chars": 20495,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport functools\nimport io\nimport struct\nimport "
  },
  {
    "path": "detectron2/export/patcher.py",
    "chars": 4667,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport contextlib\nimport mock\nimport torch\n\nfrom"
  },
  {
    "path": "detectron2/export/shared.py",
    "chars": 38063,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n\nimport collections\nimport contextlib\nimport copy"
  },
  {
    "path": "detectron2/layers/__init__.py",
    "chars": 874,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates.\nfrom .batch_norm import FrozenBatchNorm2d, get_norm, NaiveSyncBatchNo"
  },
  {
    "path": "detectron2/layers/aspp.py",
    "chars": 5764,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates.\n\nfrom copy import deepcopy\nimport fvcore.nn.weight_init as weight_ini"
  },
  {
    "path": "detectron2/layers/batch_norm.py",
    "chars": 12131,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates.\nimport torch\nimport torch.distributed as dist\nfrom fvcore.nn.distribu"
  },
  {
    "path": "detectron2/layers/blocks.py",
    "chars": 3024,
    "preview": "# -*- coding: utf-8 -*-\n# Copyright (c) Facebook, Inc. and its affiliates.\n\nimport fvcore.nn.weight_init as weight_init\n"
  },
  {
    "path": "detectron2/layers/csrc/README.md",
    "chars": 122,
    "preview": "\n\nTo add a new Op:\n\n1. Create a new directory\n2. Implement new ops there\n3. Delcare its Python interface in `vision.cpp`"
  },
  {
    "path": "detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated.h",
    "chars": 2870,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#pragma once\n#include <torch/types.h>\n\nnamespace detectron2 {\n\nat::T"
  },
  {
    "path": "detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cpu.cpp",
    "chars": 16031,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#include <ATen/TensorUtils.h>\n#include \"ROIAlignRotated.h\"\n\n// Note:"
  },
  {
    "path": "detectron2/layers/csrc/ROIAlignRotated/ROIAlignRotated_cuda.cu",
    "chars": 13876,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#include <ATen/ATen.h>\n#include <ATen/cuda/CUDAContext.h>\n#include <"
  },
  {
    "path": "detectron2/layers/csrc/box_iou_rotated/box_iou_rotated.h",
    "chars": 988,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#pragma once\n#include <torch/types.h>\n\nnamespace detectron2 {\n\nat::T"
  },
  {
    "path": "detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cpu.cpp",
    "chars": 1090,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#include \"box_iou_rotated.h\"\n#include \"box_iou_rotated_utils.h\"\n\nnam"
  },
  {
    "path": "detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_cuda.cu",
    "chars": 4454,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#include <ATen/ATen.h>\n#include <ATen/cuda/CUDAContext.h>\n#include <"
  },
  {
    "path": "detectron2/layers/csrc/box_iou_rotated/box_iou_rotated_utils.h",
    "chars": 10844,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#pragma once\n\n#include <cassert>\n#include <cmath>\n\n#if defined(__CUD"
  },
  {
    "path": "detectron2/layers/csrc/cocoeval/cocoeval.cpp",
    "chars": 20746,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#include \"cocoeval.h\"\n#include <time.h>\n#include <algorithm>\n#includ"
  },
  {
    "path": "detectron2/layers/csrc/cocoeval/cocoeval.h",
    "chars": 3515,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#pragma once\n\n#include <pybind11/numpy.h>\n#include <pybind11/pybind1"
  },
  {
    "path": "detectron2/layers/csrc/cuda_version.cu",
    "chars": 622,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n\n#include <cuda_runtime_api.h>\n\nnamespace detectron2 {\nint get_cudar"
  },
  {
    "path": "detectron2/layers/csrc/deformable/deform_conv.h",
    "chars": 8384,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#pragma once\n#include <torch/types.h>\n\nnamespace detectron2 {\n\n#if d"
  },
  {
    "path": "detectron2/layers/csrc/deformable/deform_conv_cuda.cu",
    "chars": 31785,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n\n// modified from\n// https://github.com/open-mmlab/mmdetection/blob/"
  },
  {
    "path": "detectron2/layers/csrc/deformable/deform_conv_cuda_kernel.cu",
    "chars": 44279,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n\n// modified from\n// https://github.com/open-mmlab/mmdetection/blob/"
  },
  {
    "path": "detectron2/layers/csrc/nms_rotated/nms_rotated.h",
    "chars": 1089,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#pragma once\n#include <torch/types.h>\n\nnamespace detectron2 {\n\nat::T"
  },
  {
    "path": "detectron2/layers/csrc/nms_rotated/nms_rotated_cpu.cpp",
    "chars": 2307,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#include \"../box_iou_rotated/box_iou_rotated_utils.h\"\n#include \"nms_"
  },
  {
    "path": "detectron2/layers/csrc/nms_rotated/nms_rotated_cuda.cu",
    "chars": 4859,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n#include <ATen/ATen.h>\n#include <ATen/cuda/CUDAContext.h>\n#include <"
  },
  {
    "path": "detectron2/layers/csrc/vision.cpp",
    "chars": 3167,
    "preview": "// Copyright (c) Facebook, Inc. and its affiliates.\n\n#include <torch/extension.h>\n#include \"ROIAlignRotated/ROIAlignRota"
  },
  {
    "path": "detectron2/layers/deform_conv.py",
    "chars": 16978,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates.\nimport math\nfrom functools import lru_cache\nimport torch\nfrom torch i"
  },
  {
    "path": "detectron2/layers/losses.py",
    "chars": 4202,
    "preview": "import math\nimport torch\n\n\ndef diou_loss(\n    boxes1: torch.Tensor,\n    boxes2: torch.Tensor,\n    reduction: str = \"none"
  },
  {
    "path": "detectron2/layers/mask_ops.py",
    "chars": 10879,
    "preview": "# Copyright (c) Facebook, Inc. and its affiliates.\nimport numpy as np\nfrom typing import Tuple\nimport torch\nfrom PIL imp"
  }
]

// ... and 158 more files (download for full content)

About this extraction

This page contains the full source code of the stevewongv/InstanceShadowDetection GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 358 files (4.4 MB), approximately 1.2M tokens, and a symbol index with 1896 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.

Copied to clipboard!