일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- deeplearning
- 블록체인
- pyqt
- TensorFlow
- Perceptron
- terminal
- numpy
- qtdesigner
- Inference
- itksnap
- 유로화
- keras
- cv2
- 브렉시트
- img
- Training
- Python
- error
- 유가 급등
- loss
- opencv
- 딥러닝
- 비트코인
- DataSet
- dtype
- 세계대전
- TF
- 세계사
- TFRecord
- 퍼셉트론
- Today
- Total
목록Python (50)
활연개랑
for i in range(): globals()['변수명'+str(i)] = *** for i in range(): locals()['변수명'+str(i)] = ***
numpy array로 되어있는 이미지에 다짜고짜 astype을 써버리면 이미지를 강제로 타입 변경 해버리는 것이기 때문에, 이미지에 손실이 있을 수 있습니다. 따라서 dtype을 변경하고 싶을 때에는 해당 이미지 타입에 맞는 계산법에 따라 계산해준 후 type을 변경해 주어야 합니다. 원본 이미지의 dtype이 float64일 경우, 이미지를 normalize해준 후 255로 곱해주면서 uint8에 맞는 값을 갖도록 합니다. 그 후에 astype으로 타입변경을 하시면 이미지 손상을 최소화하며 타입변경이 가능합니다. 또한 다시 되돌릴 경우에는 전에 해준 방법을 그대로 되돌리는 계산과 타입변경을 해주시면 됩니다. 코드는 float64 to unit8의 예시입니다. min_or = img.min() max_..
Input 0 of layer "conv2d" is incompatible with the layer: expected min_ndim=4, found ndim=2. Full shape received: inference 를 하는 과정에서 predict 값을 구하기 위해 model에 x값을 넣어주었을 때 다음과 같은 오류가 발생하였습니다. x의 shape은 (300,400)이었으나, model로 들어갈 때 (batch, width,height, channel)형태로 들어가 주어야 하기 때문입니다. t_x = t_x.reshape(1, t_x.shape[0], t_x.shape[1], 1) pred = model(t_x) 위와 같이 reshape을 해주면 잘 들어갑니다!
tf.numpy_function을 사용할 때 dim 관련 오류가 날 수 있습니다. tf.numpy_function을 이미지에 사용할 경우 reshape이 필요하기 때문에 다음과 같이 reshape을 해주어야 합니다. image_shape = tf.shape(image) image = tf.numpy_function(definition(func), [image], tf.float32) image = tf.reshape(image, image_shape) 이렇게 reshape을 해주면 dimensipn오류를 해결할 수 있습니다.
model inference 과정에서 다음과 같은 오류가 발생했습니다. ValueError: Exception encountered when calling layer "epvs_conv" (type EPVS_CONV). Input 0 of layer "conv2d" is incompatible with the layer: expected min_ndim=4, found ndim=2. Full shape received: (300, 400) Call arguments received: • inputs=tf.Tensor(shape=(300, 400), dtype=float32) 다음과 같은 오류가 발생한 이유는 shape이 맞지 않아서 입니다. 제가 만든 모델에는 dimension이 4인 input (bat..
eq_img = cv2.equalizeHist(img) 위와 같이 equalizehist를 하는 과정에서 아래와 같은 오류가 발생하였습니다. cv2.error: OpenCV(4.5.5) /io/opencv/modules/imgproc/src/histogram.cpp:3439: error: (-215:Assertion failed) _src.type() == CV_8UC1 in function 위 오류를 보니 대충 8bit이미지로 만들면 되는 것 같아 보입니다. 8bit 이미지로 만들어주기 위해서 astype으로 바로 바꿀 수도 있겠지만, 이미지를 제대로 살리기 위해서 normalize를 한 후 astype을 통해 8bit 정수형 이미지로 만들어주면 오류가 해결됩니다.
cv2.error: OpenCV(4.5.5) /io/opencv/modules/imgproc/src/histogram.cpp:3439: error: (-215:Assertion failed) _src.type() == CV_8UC1 in function 'equalizeHist'stackoverflow.com/questions/23660929/how-to-check-whether-a-jpeg-image-is-color-or-gray-scale-using-only-python-stdli 해당 오류가 나는 이유는 여러가지가 있습니다. 그 중 가장 주된 이유는 아래와 같습니다. 1. 이미지가 gray형태가 아니다. - bgr2gray 또는 rgb2gray 등을 통해 gray scale로 만들어 주어야 합니다...
Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl. plt.imshow()를 실행하는 와중에 다음과 같은 오류가 발생하였습니다. 저는 현재 Linux Ubuntu20.04를 사용하고 있고, 위 문제는 우분투에서만 나타나는 오류로 확인됩니다.. QT5.15버전부터 호환이 안되는 것으로 보입니다. 따라서 $ Pip list|grep Qt 위 코드를 사용하여 Qt 리스트를 확인하고 모두 uninstall 시켜준 후에, $ pip install PyQt5==5.14.2..