How to unpack pkl file?

后端 未结 4 2048
陌清茗
陌清茗 2021-01-29 23:05

I have a pkl file from MNIST dataset, which consists of handwritten digit images.

I\'d like to take a look at each of those digit images, so I need to unpack the pkl fil

4条回答
  •  遇见更好的自我
    2021-01-29 23:55

    Handy one-liner

    pkl() (
      python -c 'import pickle,sys;d=pickle.load(open(sys.argv[1],"rb"));print(d)' "$1"
    )
    pkl my.pkl
    

    Will print __str__ for the pickled object.

    The generic problem of visualizing an object is of course undefined, so if __str__ is not enough, you will need a custom script.

提交回复
热议问题