일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- C++
- Visual Studio
- VS Code
- C
- Selenium
- Numpy
- Linux
- 채보
- Python
- error
- OpenCV
- 기타 연주
- JSON
- 핑거스타일
- mysql
- pandas
- SSH
- pip
- paramiko
- windows forms
- C#
- 오류
- ubuntu
- pytorch
- nvidia-smi
- YOLO
- 컨테이너
- label
- Docker
- 프로그래머스
- Today
- Total
목록AI (33)
기계는 거짓말하지 않는다
PyTorch의 forward() 연산 방식은 기본적으로 순차적으로 실행되는 것처럼 보이지만, 내부적으로 가능한 연산을 병렬로 실행한다. 특히 GPU에서는 연산이 비동기적으로 수행될 수 있고병렬 처리를 더욱 효율적으로 활용할 수 있다.연산 그래프PyTorch에서 forward() 실행 시 생성되는 연산 그래프(Computation Graph)는동적 방식(Dynamic Computation Graph)으로 작동한다.이는 모델의 forward pass 과정에서 연산이 발생할 때마다 그래프가 즉시 생성되는 방식이다.연산 그래프의 특징동적 생성(Dynamic Graph)TensorFlow의 정적 그래프(Static Graph)와 달리, PyTorch는 실행 시점에서 그래프를 즉시 생성한다.따라서 모델 구조를 유..
torchvision.transforms.Resize에서 size 매개변수는 두 가지 사용 방식이 있다.매개변수는 int와 tuple 형식의 (height, width)을 전달할 수 있다.transforms.Resize(256)매개변수에 int 형식을 전달하면 짧은 축을 기준으로 크기를 조정한다.이는 종횡비가 유지된다.입력 이미지의 가로 또는 세로 길이 중 짧은 쪽이 256 픽셀이 되도록 이미지의 크기를 조정한다.긴 쪽은 원래 비율을 유지하면서 비례적으로 조정한다.원본 이미지가 800 x 600(width x height)인 경우, 짧은 축인 세로 길이가 256 픽셀로 조정된다.가로 길이는 size * width / height인 341 픽셀이 된다.transforms.Resize(256, 256)매개변..
Creating a tensor from a list of numpy.ndarrays is extremely slow.Please consider converting the list to a single numpy.ndarray with numpy.array()before converting to a tensor.Pytorch에서 List에 다수의 numpy.ndarray가 있을 경우 torch.tensor로 변환하는 경우 발생한다.이렇게 하면 성능이 저하될 수 있고, List를 단일 numpy.ndarray로 변환 후 tensor로 다시 변환하여야 한다.import numpy as npimport torchdef convert_to_tensor(list_of_arrays): # 리스트를 numpy..
Python torch 프레임워크 실행 시 다음과 같은 오류가 발생한 경우Could not load library libcudnn_cnn_train.so.8. Error: /usr/local/cuda-12.2/lib64/libcudnn_cnn_train.so.8: undefined symbol: _ZN5cudnn3cnn34layerNormFwd_execute_internal_implERKNS_7backend11VariantPackEP11CUstream_stRNS0_18LayerNormFwdParamsERKNS1_20NormForwardOperationEmb, version libcudnn_cnn_infer.so.8Traceback (most recent call last): File "/python_p..
YOLO 텍스트로 된 라벨 bbox를 이용하여 object들을 crop 하여 이미지로 저장하는 코드이다.확장자나 경로는 사용자에 맞게 바꿔야 한다.이미지, 라벨 이름의 짝과 개수가 맞는지는 코드 실행 전 검사하여야 한다.import cv2import osimport globdef get_x_y_points(point1_x, point1_y, point2_x, point2_y): xmin, ymin, xmax, ymax = 0, 0, 0, 0 if point1_x point2_x and point1_y point2_y: xmin = point1_x ymin = point2_y xmax = point2_x ymax = point1_y ..
YOLO 텍스트로 된 라벨 bbox를 이미지에 표시하는 샘플 코드이다. 다른 용도로 변형 가능하며, 경로는 사용자에 맞게 바꿔야 한다. import os import glob import cv2 import shutil import numpy as np # opencv 한글 경로 읽을 수 있도록 def imread(file_path): f = open(file_path.encode("utf-8"), "rb") bytes = bytearray(f.read()) npArr = np.asarray(bytes, dtype=np.uint8) return cv2.imdecode(npArr, cv2.IMREAD_UNCHANGED) # image, label 짝 체크 def pair_img_label_check(img..
Pytorch 모델 사용 시, 입력 텐서와 가중치 텐서의 데이터 유형이 서로 일치하지 않을 때 발생할 수 있는 오류이다. 아래는 오류 내용들이다. RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor RuntimeError: Input type (torch.cuda.HalfTensor) and weight type (torch.cuda.FloatTensor) should be the same ~ to() method를 이용해 같은 데이터 유형으로 만들어주면 된..
Tensorflow 2.10 GPU 버전을 사용하였다. keras 모델 fit 함수에서 오류가 발생했다. 아래는 오류 내용이다. tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name, tensorflow.python.framework.errors_impl.UnimplementedError: Graph execution error: ... Deterministic GPU implementation of unsorted segment reduction op not available. [[{{node gradient_tape/sparse_categorical_crossentropy/SparseSoftmaxCrossEntropyWithLog..