img_gen.flow()涵式中的assert用法
2019/12/18 上午 10:48
電腦視覺深度學習討論版
張恩睿
觀看數:7
回答數:1
收藏數:0
cvdl-1
cvdl-1-d16
img= np.array(img, dtype=np.float32)
img_combine=np.array([img,img,img,img],dtype=np.uint8)
batch_gen = img_gen.flow(img_combine, batch_size=4)
assert next(batch_gen).shape==(batch_size, width, height, 3)#請問做完flow之後為何還要做這個動作呢?這行指令又是甚麼意思呢?
回答列表
-
2019/12/18 上午 10:55楊哲寧贊同數:0不贊同數:0留言數:0
assert得用法等同於相方程式碼:
if not condition:
raise AssertionError()
在這裡只是要讓大家理解輸出shape的維度應該要等於(batch_size, width, height, 3)