Data science/각종 에러 6

shap.DeepExplainer 사용 시 feature value가 gray 색상인 경우

shap.DeepExplainer — SHAP latest documentation A tuple of (row_values, row_expected_values, row_mask_shapes), where row_values is an array of the attribution values for each sample, row_expected_values is an array (or single value) representing the expected value of the model for each sample (which is shap-lrjball.readthedocs.io 우선 위 documentation을 보면 shap.DeepExplainer의 경우, 다음과 같이 model에 따라 dat..

ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 32])

마지막 batch에 단일 training example만 있는 경우, 발생하는 에러 DataLoader의 drop_last=True로 설정 Expected more than 1 value per channel when training, got input size torch.Size([1, **]) I met an error when I use BatchNorm1d, code: ##% first I set a model class net(nn.Module): def __init__(self, max_len, feature_linear, rnn, input_size, hidden_size, output_dim, num__rnn_layers, stackoverflow.com

error: (-215:Assertion failed) (mtype == CV_8U || mtype == CV_8S) && _mask.sameSize(*psrc1) in function 'cv::binary_op'

post_global_result=cv2.bitwise_and(image, image, mask=post_global_mask) ​image : 환자 얼굴 이미지 post_global_mask : HSV, YCbCr, Gray 기반 추출 마스크를 모두 합친 mask -> 환자 이미지에서 모든 색공간 기반 추출 마스크를 적용하는 bitwise_and 연산을 하려고 했는데, 다음과 같은 에러가 발생 error: (-215:Assertion failed) (mtype == CV_8U || mtype == CV_8S) && _mask.sameSize(*psrc1) in function 'cv::binary_op' * 구글링 결과, 에러가 발생하는 다음 3가지 이유가 있었음. ​ 1. 이미지 크기가 다름 -> i..

RuntimeError: stack expects each tensor to be equal size, but got [3, 224, 224] at entry 0

RuntimeError: stack expects each tensor to be equal size, but got [3, 224, 224] at entry 0 and [3, 225, 224] at entry 13 ▶ 해결 방법 : 원래 코드 transforms.Resize(224) → transforms.Resize((224, 224)) train_dataset = datasets.ImageFolder( traindir, transforms.Compose([ transforms.Resize(224), # 224 -> (224,224) transforms.RandomHorizontalFlip(), transforms.ToTensor(), normalize, ])) 아래 링크를 보면 이미지의 height..

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

* matplolib.pyplot 실행 시 dead kernel jupyter notebook에서 plt.figure() 실행 시 계속해서 커널이 죽고, 프롬프트에는 다음과 같이 떴다. 검색 결과 mkl 라이브러리가 여러군데 설치되어 있어서 발생하는 문제였다. (참고) OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized. OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or ca..

for epoch in range(args.epochs):에서 TypeError: 'int' object is not callable

for epoch in range(args.epochs): # train train_acc, train_auc, train_loss, train_history = train(train_loader, model, criterion, optimizer, epoch, device) train_perf['train_acc'].append(train_acc) .... 잘만 돌아가던 위 for epoch in range(args.epochs) 코드를 돌리니 갑자기 TypeError: 'int' object is not callable 발생 찾아보니 예약어를 변수명으로 사용해서 나타난 에러였음 (참고 링크) 다음과 같이 epoch을 돌리기 전에 augmented train set을 가져오는 코드에서 range 변수를..