Advertisement
Guest User

Testing divide_img_blocks method

a guest
Oct 27th, 2021
548
-1
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.16 KB | None | 0 1
  1. n_tests = 1000
  2. for i in range(n_tests):
  3.     blocks = divide_img_blocks(np.random.rand(randint(10,1000), randint(10,1000), 3), (randint(2,100), randint(2,100)))
Advertisement
Comments
  • ahmadsum11
    1 year
    # text 0.64 KB | 0 0
    1. ValueError Traceback (most recent call last)
    2. Cell In[79], line 4
    3. 2 n_tests = 1000
    4. 3 for i in range(n_tests):
    5. ----> 4 blocks = divide_img_blocks(np.random.rand(randint(10,1000), randint(10,1000), 3), (randint(2,100), randint(2,100)))
    6.  
    7. Cell In[67], line 4, in divide_img_blocks(img, n_blocks)
    8. 2 horizontal = np.array_split(img, n_blocks[0])
    9. 3 splitted_img = [np.array_split(block, n_blocks[1], axis=1) for block in horizontal]
    10. ----> 4 return np.asarray(splitted_img, dtype=np.ndarray).reshape(n_blocks)
    11.  
    12. ValueError: could not broadcast input array from shape (10,5,3) into shape (10,)
Add Comment
Please, Sign In to add comment
Advertisement