Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Sign in
M
maskrcnn
  • Project
    • Project
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • 人工智能
  • maskrcnn
  • Repository

Switch branch/tag
  • maskrcnn
  • tools
  • cityscapes
  • convert_cityscapes_to_coco.py
Find file
BlameHistoryPermalink
  • Csaba Botos's avatar
    Remove Detectron dependency (#457) · 0f9476bd
    Csaba Botos authored Feb 18, 2019
    * Remove Detectron dependency
    
    I have looked into the boxes.py to swap [these lines](https://github.com/facebookresearch/Detectron/blob/8170b25b425967f8f1c7d715bea3c5b8d9536cd8/detectron/utils/boxes.py#L51L52):
    ```
    import detectron.utils.cython_bbox as cython_bbox
    import detectron.utils.cython_nms as cython_nms
    ```
    
    ```
    from maskrcnn_benchmark.structures.boxlist_ops import boxlist_iou
    from maskrcnn_benchmark.structures.boxlist_ops import boxlist_nms
    ```
    However some functions are missing from the `boxlist_ops` like the [`soft_nms`](https://github.com/facebookresearch/Detectron/blob/master/detectron/utils/cython_nms.pyx#L98L203) .
    
    So I just tried to modify the `maskrcnn-benchmark/tools/cityscapes/convert_cityscapes_to_coco.py` script.
    Here we have `polys_to_boxes` function from `segms.py` and I could not find its analogous in the maskrcnn_benchmark lib. It seems to me that the original function in `segms.py` is using pure lists so I just wrote two auxiliary functions reusing the boxList's convert method( https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/maskrcnn_benchmark/structures/bounding_box.py#L67L70 )
    and Detectron's polys_to_boxes ( https://github.com/facebookresearch/Detectron/blob/b5dcc0fe1d091cb70f9243939258215dd63e3dfa/detectron/utils/segms.py#L135L140 ):
    ```
    def poly_to_box(poly):
        """Convert a polygon into a tight bounding box."""
        x0 = min(min(p[::2]) for p in poly)
        x1 = max(max(p[::2]) for p in poly)
        y0 = min(min(p[1::2]) for p in poly)
        y1 = max(max(p[1::2]) for p in poly)
        box_from_poly = [x0, y0, x1, y1]
    
        return box_from_poly
    
    def xyxy_to_xywh(xyxy_box):
        xmin, ymin, xmax, ymax = xyxy_box
        TO_REMOVE = 1
        xywh_box = (xmin, ymin, xmax - xmin + TO_REMOVE, ymax - ymin + TO_REMOVE)
        return xywh_box
    ```
    
    * removed leftovers
    
    * Update convert_cityscapes_to_coco.py
    0f9476bd
convert_cityscapes_to_coco.py 8.59 KB
EditWeb IDE

Replace convert_cityscapes_to_coco.py

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.