速度慢到快
start = time.time()
img = cv2.imdecode(np.fromstring(img, dtype=np.uint8),-1)
# 因为cv2会把内容先保存到一个临时文件里面然后再读
print(time.time() - start)
start = time.time()
aa = cv2.imdecode(np.frombuffer(file_read, dtype=np.int8), cv2.IMREAD_UNCHANGED)
print(time.time() - start)
# https://libjpeg-turbo.org/pmwiki/uploads/Downloads/libjpeg-turbo.repo
sudo cp libjpeg-turbo.repo /etc/yum.repos.d/
# sudo yum -y upgrade
sudo yum install libjpeg-turbo-official
/home/deploy/anaconda3/envs/yolov5_py38_cu102_conda/bin/pip install -U git+git://github.com/lilohuang/PyTurboJPEG.git
from turbojpeg import TurboJPEG, TJPF_GRAY, TJSAMP_GRAY, TJFLAG_PROGRESSIVE
start = time.time()
jpeg = TurboJPEG()
bb = jpeg.decode(file_read)
print(time.time() - start)