class_docstr: Test for ndarray utils.
class_docstr_tok: ["Test","for","ndarray","utils","."]
code: def test_to_ndarray(self):
      ndarray_img = cv2.imread(logo_path)
      # img_bytes = ndarray_img.tobytes()
      # img_width = ndarray_img.shape[1]
      # img_height = ndarray_img.shape[0]
      # img_channel = len(cv2.split(ndarray_img))
      img_mode = "BGR"
      img_array = ndarray_img
  
      towhee_img = Image(img_array, img_mode)
      ndarray_img = to_ndarray(towhee_img)
  
      self.assertIsInstance(ndarray_img, np.ndarray)
  
      self.assertEqual(ndarray_img.shape[0], towhee_img.height)
      self.assertEqual(ndarray_img.shape[1], towhee_img.width)
      self.assertEqual(ndarray_img.shape[2], towhee_img.channel)
      self.assertEqual("BGR", towhee_img.mode)
      self.assertTrue((ndarray_img == towhee_img).all())
  
file_path: towhee/tests/unittests/utils/test_ndarray_utils.py
imports: import os
  import unittest
  import numpy
  from pathlib import Path
  from towhee.utils.cv2_utils import cv2
  from towhee.types import Image
  from towhee.utils.ndarray_utils import from_ndarray, from_src, to_ndarray, rgb2bgr
label_desc: Use image node_id 3 for calling the TestPilUtils obj's underlying member method code with example usage: obj.test_to_ndarray() without return types