회전, 그레이스케일링, 자르기
rgb 값을 반복문으로 빈 리스트에 저장
리스트에 저장한 값을 JSON으로 저장
저장한 JSON을 불러와 원본 이미지로 복원
저장한 JSON 리스트의 길이 및 타입을 체크하고, 2차원->1차원 리스트로 평탄화
matplotlib 라이브러리를 사용해 차이점을 그래프화
그레이스케일링의 의의 탐색
Git LFS 시도 실패 이후, JAVA를 설치하고, BFG Repo-Cleaner로 이전의 작업 내용 중 *.json 관련 내용을 삭제하고 강제로 푸시해서 성공
OpenCV git push origin main
Enumerating objects: 73, done.
Counting objects: 100% (73/73), done.
Delta compression using up to 16 threads
Compressing objects: 100% (69/69), done.
error: RPC failed; HTTP 400 curl 92 HTTP/2 stream 7 was not closed cleanly: CANCEL (err 8)
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (71/71), 107.94 MiB | 3.20 MiB/s, done.
Total 71 (delta 30), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
1-2-1. Git LFS 설치
설치 명령: git lfs install
설치 확인:
OpenCV git lfs install
Updated Git hooks.
Git LFS initialized.
1-2-2. Git LFS가 추적할 파일의 유형 설정
세팅 명령: git lfs track *.json
세팅 확인:
OpenCV git lfs track *.json
Tracking "*.json"
1-2-3. Git에 변경 사항을 커밋 새롭게 생성된 .gitattributes 파일을 커밋
커밋 명령: git commit -m "Setup: Git LFS로 대용량 JSON 파일을 추적
커밋 확인:
OpenCV git commit -m "Setup: Git LFS로 대용량 JSON 파일을 추적"
[main 4986212] Setup: Git LFS로 대용량 JSON 파일을 추적
4 files changed, 10 insertions(+), 3 deletions(-)
create mode 100644 .gitattributes
1-2-4. main 브랜치에 커밋한 내용을 푸시
푸시 명령: git push origin main
푸시 실패:
OpenCV git push origin main
Uploading LFS objects: 100% (3/3), 690 MB | 0 B/s, done.
Enumerating objects: 79, done.
Counting objects: 100% (79/79), done.
Delta compression using up to 16 threads
Compressing objects: 100% (74/74), done.
error: RPC failed; HTTP 400 curl 92 HTTP/2 stream 7 was not closed cleanly: CANCEL (err 8)
send-pack: unexpected disconnect while reading sideband packet
Writing objects: 100% (77/77), 107.94 MiB | 3.14 MiB/s, done.
Total 77 (delta 31), reused 0 (delta 0), pack-reused 0
fatal: the remote end hung up unexpectedly
Everything up-to-date
JSON 파일의 크기가 매우 크므로, 직접 push하는 것이 권장되지 않는다고 한다.
파일을 분할하거나, 외부의 데이터 저장소(Amazon S3, Google Cloud Storage 등)를 사용해 외부에 저장하는 것이 적절하다고 한다.
-
color_codes.json(310MB)을 삭제
삭제 명령 및 확인:
OpenCV git rm --cached color_codes.json rm 'color_codes.json' -
color_codes_flat.json(270MB)를 삭제
삭제 명령 및 확인:
OpenCV git rm --cached color_codes_flat.json rm 'color_codes_flat.json' -
gray_color_codes.json(90MB)를 삭제
삭제 명령 및 확인:
OpenCV git rm --cached gray_color_codes.json rm 'gray_color_codes.json' -
새로운 커밋
커밋 명령 및 확인:
OpenCV git commit -m "Fix: 대용량 JSON 파일들의 캐시된 데이터 삭제" [main c3b7006] Fix: 대용량 JSON 파일들 삭제 in pwsh at 12:20:38 2 files changed, 6 deletions(-) delete mode 100644 color_codes.json delete mode 100644 color_codes_flat.json푸쉬 시도 및 실패:
OpenCV git push origin main Uploading LFS objects: 100% (3/3), 690 MB | 0 B/s, done. Enumerating objects: 86, done. Counting objects: 100% (86/86), done. Delta compression using up to 16 threads Compressing objects: 100% (80/80), done. error: RPC failed; HTTP 400 curl 92 HTTP/2 stream 7 was not closed cleanly: CANCEL (err 8) send-pack: unexpected disconnect while reading sideband packet Writing objects: 100% (84/84), 107.94 MiB | 3.15 MiB/s, done. Total 84 (delta 34), reused 0 (delta 0), pack-reused 0 fatal: the remote end hung up unexpectedly Everything up-to-date
-
JAVA 설치 및 확인
OpenCV java -version java version "1.8.0_401" Java(TM) SE Runtime Environment (build 1.8.0_401-b10) Java HotSpot(TM) Client VM (build 25.401-b10, mixed mode, sharing) -
BFG 설치 및 확인
https://rtyley.github.io/bfg-repo-cleaner/에서 bfg-1.14.0 설치(Downloads/ 경로에 위치)
-
BFG Repo-Cleaner 실행 및 JSON 삭제
삭제 명령:
java -jar C:\Users\Administrator\Downloads\bfg-1.14.0.jar --delete-files *.json삭제 확인: 내용이 길어서 bfg.md를 따로 생성해 저장
-
Git Reflog 만료 및 불필요한 객체 삭제
삭제 명령:
git reflog expire --expire=now --all; git gc --prune=now --aggressive삭제 확인:
OpenCV git reflog expire --expire=now --all; git gc --prune=now --aggressive Enumerating objects: 82, done. Counting objects: 100% (82/82), done. Delta compression using up to 16 threads Compressing objects: 100% (76/76), done. Writing objects: 100% (82/82), done. Total 82 (delta 35), reused 3 (delta 0), pack-reused 0 -
원격 저장소에 강제 푸시
푸시 명령:
git push origin --force --all푸시 확인:
OpenCV git push origin --force --all Enumerating objects: 81, done. Counting objects: 100% (81/81), done. Delta compression using up to 16 threads Compressing objects: 100% (40/40), done. Writing objects: 100% (79/79), 70.69 KiB | 70.69 MiB/s, done. Total 79 (delta 35), reused 79 (delta 35), pack-reused 0 remote: Resolving deltas: 100% (35/35), done. To https://github.com/dev-honing/OpenCV.git 426f927..9d0cf4d main -> main
