Skip to content

Instantly share code, notes, and snippets.

@mstfldmr
Created April 29, 2019 11:56
Show Gist options
  • Select an option

  • Save mstfldmr/a34fa6347cbc445a42ba66d657a15347 to your computer and use it in GitHub Desktop.

Select an option

Save mstfldmr/a34fa6347cbc445a42ba66d657a15347 to your computer and use it in GitHub Desktop.

Revisions

  1. mstfldmr created this gist Apr 29, 2019.
    8 changes: 8 additions & 0 deletions Convert channels_first to channels_last
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    # MXNet uses channels_first data format while Tensorflow uses channels_last data format.

    img.shape
    # (3, 224, 224)

    x = np.moveaxis(img, 0, 2)
    x.shape
    # (224, 224, 3)