美文网首页
mxnet 加载rec文件, 并展示图片检测

mxnet 加载rec文件, 并展示图片检测

作者: yfmei | 来源:发表于2018-03-09 14:48 被阅读0次
    import mxnet as mx
    import mxnet.ndarray as nd
    from skimage import io
    import numpy as np
    rec_path = path_prefix + ".rec"
    idx_path = path_prefix + ".idx"
    print(rec_path)
    
    train_iter = mx.image.ImageIter(
        batch_size=3,
        data_shape=(3, 512, 512),
        path_imgrec=rec_path,
        path_imgidx=idx_path,
        shuffle=True)  
    
    train_iter.reset()
    
    for batch in train_iter:
        x = batch.data[0]
        y = batch.label[0]
        break
    
    print(y[0])
    
    img = nd.transpose(x, (0, 2, 3, 1))
    print(img.shape)
    io.imshow(img[0].asnumpy().astype(np.uint8))
    io.show()
    

    相关文章

      网友评论

          本文标题:mxnet 加载rec文件, 并展示图片检测

          本文链接:https://www.haomeiwen.com/subject/yqgpfftx.html