일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
- logistic regression
- Pull Request
- 머신러닝
- 코크리
- linear regression
- docker attach
- 프로그래머스
- vscode
- 기초확률론
- aiffel exploration
- CellPin
- airflow
- AIFFEL
- IVI
- WSSS
- ssh
- GIT
- Decision Boundary
- 사회조사분석사2급
- 백신후원
- cs231n
- cocre
- docker exec
- HookNet
- numpy
- docker
- Jupyter notebook
- 도커
- 히비스서커스
- Multi-Resolution Networks for Semantic Segmentation in Whole Slide Images
- Today
- Total
목록Programming/Python (39)
히비스서커스의 블로그
상황 np.where 후 cv2.findContours을 해주었더니 에러가 발생하였다. 대략적인 코드 import numpy as np import cv2 mask = np.zeros((300,300)) pts1 = [np.array([(100, 200), (100, 200), (200, 200), (200, 100)], dtype=np.int32)] cv2.drawContours(mask, pts1, -1, 2.5, 10) cv2.findContours(mask, ,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_NONE) 에러메시지 error: OpenCV(4.5.4) /tmp/pip-req-build-sokf1_ny/opencv/modules/imgproc/src/contours.cp..
상황 torch로 segmentation model을 돌리는 상황에서 발생하였다. 대략적인 코드 # import unet from seg_model.py from seg_model import unet import torch # output 3 classes model = unet(class=3) # loss 4 classes weights = torch.tensor([1.2, 2.6, 7.5, 17.0], dtype=torch.float32) loss = torch.nn.CrossEntropyLoss(weight=weights) 에러메시지 RuntimeError: only batches of spatial targets supported (3D tensors) but got targets of size..
일반적으로 딥러닝 모델은 많은 이미지를 학습할수록 더 좋은 성능을 내지만 실질적으로 이미지의 수가 부족한 경우가 매우 많다. 그럴 때 사용하는 것이 image augmentation으로 가지고 있는 image를 변형하여 모델이 좀 더 다양한 데이터를 학습할 수 있도록 한다. 이런 image augmentation의 적용을 쉽게하고자 albumentations라는 라이브러리가 존재한다. 이 라이브러리를 더욱 확장성 있게 활용하는 방법(여러 이미지 적용, OneOf 활용 등)들을 알아보자. 기본 가장 간단한 활용할 수 있는 코드를 살펴보자. 먼저 augmentation 정의하는 코드는 다음과 같다. from albumentations import * def test_aug(): ret = Compose([ ..
상황 cv2.imwrite()를 쓰는 상황에서 에러가 발생하였다. 대략적인 코드 import numpy as np import cv2 name = 'sample_001.svs' mask = np.zeors((512,512), dtype=np.uint8) cv2.imwrite(f'../test_inference/results/{name[-7:-4]}/{name}', mask) 에러 메세지 error: OpenCV(4.5.4) /tmp/pip-req-build-sokf1_ny/opencv/modules/imgcodecs/src/loadsave.cpp:728: error: (-2:Unspecified error) could not find a writer for the specified extension in..
상황 np.argmax함수를 쓴 후 cv2.resize 해주려던 찰나 다음과 같은 에러 메세지를 마주하였다. 대략적인 코드 import numpy as np import cv2 # np.argmax를 위한 과정 arg_max = np.zeros((512,512,3)) arg_max[...,1] = np.where(mask==1,1,0) arg_max[...,2] = np.where(mask==2,1,0) arg_max[...,0] = np.ones((512,512)) - arg_max[...,1] - arg_max[...,2] arg_max = np.argmax(arg_max, axis=2) # cv2.resize를 위한 과정 arg_max_resized = cv2.resize(arg_max, (128,..
pytorch tensorboard tutorial를 참조하며 코드를 작성한 후 모델을 돌려보던 중 다음과 같은 에러를 마주하였다. pytorch tensorboard tutorial https://tutorials.pytorch.kr/intermediate/tensorboard_tutorial.html TensorBoard로 모델, 데이터, 학습 시각화하기 — PyTorch Tutorials 1.10.0+cu102 documentation TensorBoard로 모델, 데이터, 학습 시각화하기 PyTorch로 딥러닝하기: 60분만에 끝장내기 에서는 데이터를 불러오고, nn.Module 의 서브클래스(subclass)로 정의한 모델에 데이터를 공급(feed)하고, 학습 데이 tutorials.pytorc..
pytorch로 모델을 직접 설계하여 모델을 학습시킨 후 model.predict()을 하였으나 model에는 predict 특성이 없다는 에러가 발생하였다. 상황 설계한 모델형식 (간단하게 줄여서 나타냄) import torch import torch.nn as nn class simple_model(nn.Module): def __int__(self, inchannels, out_channels, kernel_size, stride, padding): super().__init__() self.conv = nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=kernel_size, stride=stride, padding=..
주피터 노트북에서 잘 실행되는 코드를 본격적으로 파이썬 파일로 모듈화 하여 실행하였다. 도중에 'no module named '와 같은 에러가 발생하였다. 터미널에서 라이브러리들을 설치해봐도 똑같은 상황이다. 실행되는 파이썬 경로가 다름을 직감하였다. 실행되는 파이썬 버전 확인하기 import sys print(sys.executable) 주피터 노트북은 3.8이었으나 터미널은 3.6.9임을 확인하였다. 터미널에서 라이브러리를 설치한 것도 3.6.9에 설치된 것으로 보인다. 터미널에서 실행되는 파이썬 버전 변경하기 (실행 우선순위 변경) 먼저 설치된 파이썬 경로부터 확인 $ ls /usr/bin/ | grep python 파이썬 실행 우선순위 변경 $ update-alternatives --install..