-
[파이썬/Python] 파이썬 코드 소요시간 실험프로그래밍_Programming/파이썬_Python 2020. 11. 30. 22:05
1. 임시적으로 for 문 수행시간
impor time t = time.time() # Code to measure for ii in range(10): print("test", end='\r') print("{} {:.20f} s {}".format('='*5, calc_t, '='*5))
===== 0.00099658966064453125 s =====
2.
dir_root = os.getcwd() path_target = os.path.join(dir_root,'time_test_image/time_test.png') t = time.time() # load image(4K) # cv2 img = cv2.imread(path_target) # PIL #img = Image.open(path_target).convert('RGB') calc_t = time.time()-t print("{} {:.20f} s {}".format('='*5, calc_t, '='*5))
===== 0.11699914932250976562 s =====
dir_root = os.getcwd() path_target = os.path.join(dir_root,'time_test_image/time_test.png') t = time.time() # load image(4K) # cv2 #img = cv2.imread(path_target) # PIL img = Image.open(path_target).convert('RGB') calc_t = time.time()-t print("{} {:.20f} s {}".format('='*5, calc_t, '='*5))
===== 0.11899852752685546875 s =====
cv2와 PIL 의 4k 이미지 로드 시간은 거의 유사하다.
3. 단순 4k 이미지 연산
4k 이미지 기준
tensorflow는 0.005 s
numpy 는 0.007 s
5/7*100 29% tensorflow 계산이 속도가 빠름.
'프로그래밍_Programming > 파이썬_Python' 카테고리의 다른 글
[파이썬:Python] json file manager source codes (0) 2022.03.09