版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Arctic_Beacon/article/details/86630153
函数用法
Generates a random sample from a given 1-D array
import numpy
numpy.random.choice(100, 3)
输出:array([83, 80, 65])
numpy.random.choice([1,0.2,7,'c'],2)
输出:array(['c', '0.2'],
dtype='|S32')
场景应用
ix = np.random.choice(np.arange(len(trainingdata)), batch_size)
img=[]
for i in ix:
img_array=cv2.imread()
img.append(img_array)
减配版
numpy.random.
randint
(low, high=None, size=None, dtype='l')
扫描二维码关注公众号,回复:
5081578 查看本文章
Return random integers from low (inclusive) to high (exclusive).