MCPcopy Create free account
hub / github.com/YeWR/EfficientZero / arr_to_str

Function arr_to_str

core/utils.py:322–328  ·  view source on GitHub ↗

To reduce memory usage, we choose to store the jpeg strings of image instead of the numpy array in the buffer. This function encodes the observation numpy arr to the jpeg strings

(arr)

Source from the content-addressed store, hash-verified

320
321
322def arr_to_str(arr):
323 """To reduce memory usage, we choose to store the jpeg strings of image instead of the numpy array in the buffer.
324 This function encodes the observation numpy arr to the jpeg strings
325 """
326 img_str = cv2.imencode('.jpg', arr)[1].tobytes()
327
328 return img_str
329
330
331def str_to_arr(s, gray_scale=False):

Callers 2

stepMethod · 0.90
resetMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected