티스토리 친구하기

본문 바로가기

Error

(15)
IndexError: arrays used as indices must be of integer (or boolean) type python으로 코딩을 할 때, index를 integer(정수형)으로 쓰지 않으면 위와 같은 Error가 발생한다. a[0.1] = 10 % 위와 같이 쓰면 에러발생 a[0] = 10 % 괄호안은 항상 integer 값을 넣어야함. % 실수로 float형이나 index를 계산할 경우 위와 같은 문제가 발생할 수 있음.
TypeError: only size-1 arrays can be converted to Python scalars 이 오류의 주요 원인은 스칼라 값을 허용하는 매개 변수에 배열을 전달하는 것입니다. 아래의 예제처럼 배열과 scalar 값을 비교하도록 잘 못 코딩을 하면 발생할 수 있습니다. a[0] = [10, 20] if a[0] > 15: ~~~ else: ~~~ 따라서, 아래와 같이 코딩하면 문제를 해결할 수 있습니다. a[0] = [10, 20] if a[0,0] > 15: ~~~ else: ~~~ Reference [1] https://www.pythonpool.com/only-size-1-arrays-can-be-converted-to-python-scalars-error-solved/
Error Q.1 Error : Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above. #24828 A.1 I had the same issue with TensorFlow 1.12 on an almost identical system as yours. Solution is to downgrade TensorFlow to 1.8.0 using: pip uninstall tensorflow-gpu pip install --upgrade tensorflow-gpu==1.8.0 Q.2 E: Could..
ModuleNotFoundError: No module named 'PIL' 다음 명령어를 터미널에 입력하여 PIL을 다운로드 합니다. python3 -m pip install pillow --user Reference [1] https://www.it-swarm.dev/ko/python/pil%EC%9D%B4%EB%9D%BC%EB%8A%94-%EB%AA%A8%EB%93%88-%EC%97%86%EC%9D%8C/825860178/
ModuleNotFoundError: No module named 'numpy' 아래의 명령어를 터미널에 입력하여 numpy를 설치합니다. python3 -m pip install numpy --user Reference [1] https://excelsior-cjh.tistory.com/52
ImportError: No module named '_tkinter', please install the python3-tk package python3에서 matplotlib를 이용해서 plot을 하려고 할 때, 다음과 같은 오류가 발생할 수 있습니다. Tkinter는 Tcl/Tk에 대한 파이썬 Wrapper로서 Tcl/Tk를 파이썬에 사용할 수 있도록 한 Lightweight GUI 모듈입니다[4]. 저도 무슨말인지 잘 모르겠네요ㅠ. 그냥 tkinter는 쉽고 간단한 GUI 프로그램을 만들 때 사용되는데 python에 기본으로 내장되어 있다고 이해하시면 됩니다. 그래서 matplotlib로 그래프를 그릴 때 활용되는 것 같습니다. 위의 에러는 아마 python 버전에 맞게 설치가 되지 않거나 경로가 꼬여서 생기는 에러인 것 같습니다. 그래서 다음과 같이 해결하시면 됩니다. * 설치되어 있는 python 버전에 따라 python3.x 또는..
cv2.error: /home/jg/opencv/opencv-3.2.0/modules/imgproc/src/color.cpp:9748: error: (-215) scn == 3 || scn == 4 in function cvtColor 위의 에러는 cv2.cvtColor에 입력될 이미지의 채널이 맞지 않아서 발생합니다. BGR2GRAY는 BGR의 3 채널 color 이미지를 1 채널의 gray 이미지로 바꾸는 API입니다. 이 API에 입력해야 할 이미지는 3 채널 이미지인데 입력으로 1 채널 이미지를 넣으면 위와 같은 에러가 발생합니다. 위의 이미지가 발생하면 입력할 이미지의 shape을 print('img1.shape: ', img1.shape) 명령어를 통해 확인해보시고 3 채널 이미지로 넣어주시면 위와 같은 에러 없이 API가 잘 실행될 겁니다.
[Error] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA 위의 내용은 에러가 아니고 경고다. 다음 명령어들 SSE4.1 SSE4.2 AVX AVX2 FMA 를 사용하면 CPU는 선형대수 연산을 좀 더 빠르게 수행할 수 있다. 위의 경고를 없애기 위해서는 1)무시하는 방법과 2) 환경에 맞게 텐서플로우 바이너리를 다시 빌드하는 방법이 있지만, 여기에서는 2) 방법만 설명하려고 한다. 아래의 링크에 들어가서 환경에 맞는 텐서플로우 바이너리 파일을 다운로드한다. https://github.com/lakshayg/tensorflow-build 터미널을 이용하여 다운로드한 폴더(디렉토리)로 이동한 후, 다음 명령어를 입력한다. pip install --ignore-installed --upgrade --user 예를들면, pip install --ignore-insta..