generating batch of clones from image numpy

前端 未结 3 459
旧巷少年郎
旧巷少年郎 2021-01-13 08:05

I have a numpy array (an image) called a with this size:

[3,128,192]

now i want create a numpy array tha

3条回答
  •  囚心锁ツ
    2021-01-13 08:22

    You can use np.repeat methods together with np.newaxis:

    import numpy as np
    
    test = np.random.randn(3,128,192)
    result = np.repeat(test[np.newaxis,...], 10, axis=0)
    print(result.shape)
    >> (10, 3, 128, 192)
    

提交回复
热议问题