Skip to content

[feat] Channel-First Storage (C, H, W)? #47

@kuang-da

Description

@kuang-da

When optimizing for GPU, (C, H, W) gives contigent memory if we transfer data between GPU and CPU. But we currently use (H, W, C) to save image.

The following is the potential plan, but we do not have to implement it right now.

Implementation: Change codex_patches.py to save/load as (C, H, W) instead of (H, W, C)

Current: patch_img[:, :, idx] → non-contiguous

Proposed: patch_img[idx, :, :] → contiguous!

Pros:

  • Zero runtime overhead - slices are naturally contiguous
  • Most efficient long-term solution

Cons:

  • Breaking change - existing saved patches incompatible
  • Requires re-running segmentation or migration code
  • Many libraries expect (H, W, C): scikit-image, matplotlib, OpenCV
  • Segmentation models (DeepCell) expect (H, W, C) input
  • High risk of bugs throughout pipeline

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions