Loading...
2024. 4. 23. 23:15

pooling은 왜 사용하는가?

이미지 사이즈를 줄이거나 fully connected 연산을 대체하기 위해 사용함 (average pooling) input을 filter에 의해 convolution 연산을 하고 pooling을 통해 이미지 사이즈를 줄인 output을 얻는 것이 기본적인 CNN 이미지에 있는 pixel 정보를 압축하면서 이미지 사이즈를 줄인다. max pooling, average pooling 등 여러가지가 있다. 다음은 4*4이미지에서 2*2 max pooling을 적용한 모습 다음은 4*4이미지에서 2*2 average pooling을 적용한 모습 pooling을 사용한 기본적인 CNN 구조

2024. 4. 23. 01:51

Unity 기본9 - enum, struct

1. enum 저장되는 데이터에 이름을 붙여서 읽기 편한 코드를 만드는 것 내부적으로는 int로 정수형과 같다 0,1,2,... 로 되는데.. arrow - 0 bullet - 1 missile - 2 ... 파이썬의 enumerate 같은 거인듯? using System.Collections; using System.Collections.Generic; using UnityEngine; public class HelloWorld : MonoBehaviour { enum ProjectileKind { Arrow, Bullet, Missile } // Start is called before the first frame update void Start() { ProjectileKind kind; kind ..

2024. 4. 22. 23:43

matplotlib.pyplot의 gray image 출력이 이상하다면

흑백이미지를 준비하고 matplotlib.pyplot에서 plt.imshow로 출력을 해보면 cmap이라는 옵션을 줘야한다 color map이라는 뜻인데 기본값이 viridis라고 한다. 실제로 색이 비슷한걸 보니 그런것 같다 This parameter is ignored if X is RGB(A). 마지막에 이런 문장이 있는데, X가 RGB image면 cmap을 무시한다고 한다 channel 3인 gray image로 줬을 때는 cmap을 안줘도 gray로 잘 나온다

2024. 4. 22. 23:24

gray image의 channel은 1이 아니다

그냥 channel이 1이면 gray image이고 channel이 3이면 color image다 라고 생각해왔는데... 파이썬으로 gray image를 불렀을때 channel이 3인데 gray로 나오는 것 보고 갑자기 궁금증이 생겼다 핵심은 image의 channel이 3이면 각각 R,G,B pixel의 value값을 나타내는데, 이들이 합쳐져서 color image가 나온다. 그런데 R,G,B pixel의 value가 모두 동일하면 gray image가 나온다 먼저 color image를 보면 Image.open으로 열어서 torchvision.transforms.ToTensor()로 tensor로 바꾸면 from PIL import Image from torchvision import dataset..

2024. 4. 22. 02:43

딥러닝 중 UnidentifiedImageError: cannot identify image file 의 에러가 나올때

dataloader에서 이미지를 뽑아 모델에 넣어 성능 평가를 하려고 하는데.. PIL.UnidentifiedImageError: cannot identify image file 이런 에러가 나는데 /content/notMNIST_large/D/VHJhbnNpdCBCb2xkLnR0Zg==.png 파일에 무슨 문제가 있는 것이 아닐까? 생각을 해봤다 os.listdir로 일단 파일이 실제 있는지 확인을 해본다 그래서 PIL.Image.open을 이용해서 open을 해보려고 하면 다른 파일로 한번 open을 해보면 문제 없이 열리긴 한다 파일이 있다는 것은 확인했는데.. 안열린다면.. 그 파일이 문제겠지 os.path.getsize()는 해당 경로의 파일의 용량을 알려준다 0바이트라 데이터 파일이 깨져있나보..

2024. 4. 22. 02:31

colab에서 데이터를 준비하는 필수 명령어 wget, gunzip, unzip, tar xf,

!wget (url) 하면 해당 url의 파일을 다운로드 받는다 .tar.gz 형태로 압축이 되어있는데, gz 형태의 압축은 !gunzip으로 압축해제가능 !gunzip (파일명) 하면 해당 파일의 gz압축을 푼다 원래 notMNIST_large.tar.gz가 notMNIST_larget.tar로 바뀜 https://unix.stackexchange.com/questions/48690/whats-the-difference-between-gunzip-and-unzip What's the difference between gunzip and unzip? What is the difference between gunzip and unzip? Tried to search but couldn't find anyt..