데이터 과학/딥러닝 FrameWork 썸네일형 리스트형 Tensorboard에서 Open3D 사용하기 Getting started 데이터 셋 읽기 import open3d.ml.torch as ml3d # construct a dataset by specifying dataset_path dataset = ml3d.datasets.SemanticKITTI(dataset_path='/path/to/SemanticKITTI/') # get the 'all' split that combines training, validation and test set all_split = dataset.get_split('all') # print the attributes of the first datum print(all_split.get_attr(0)) # print the shape of the first point .. 더보기 torch_scatter 설치 본인의 경우 python3.8버전에 pytorch는 1.12.1 버전이었고, cuda는 11.6 버전이었다. rusty1s/pytorch_scatter: PyTorch Extension Library of Optimized Scatter Operations (github.com) 에서 Binaries로 설치하기 위해 https://data.pyg.org/whl/ 사이트에서 아래의 설치 파일을 다운 받아 pip로 설치 하였다. 하지만,, 계속 에러가 났다. (이것 때문에 시간을 1시간 30분 낭비하다가...) pytorch를 1.12.0으로 다운그레이드 해주었고(Previous PyTorch Versions | PyTorch), cuda는 11.6 버전 유지. pip install torch==1.12.0.. 더보기 RNN & LSTM 설명 및 구현(pytorch) ※ 본 포스팅은 아래 링크 문서 및 다수 파이토치 포럼 글을 참고하여 만든것 입니다. pytorch.org/tutorials/beginner/nlp/sequence_models_tutorial.html 참고) LSTM 설명 포스팅 참고) Time Series Forecasting using LSTM 1) LSTM in Pytorch 1-1) Pytorch 사용법 1-2) LSTM 사용시 궁금한 부분과 모은 답변 1-3) Multivariate time series (anomaly) data using LSTM 1) LSTM in Pytorch "Sequence models are central to NLP: they are models where there is some sort of dependence.. 더보기 모델 앙상블(ensemble) 하기 학습이 잘된 몇가지 모델이 있고, 각각의 모델의 성능을 결합하여 최선의 결과를 얻고 싶을 때 모델 앙상블을 이용한다. 예시) 잘 학습된 가중치를 포함한 모델 1~3이 있다고 하자. 모델을 통해 추론한 결과는 (5000, 26) 사이즈를 갖는다고 가정해 보자. 모델 3개를 통해 추론한 결과를 앙상블 하는 과정은 다음과 같이 정리할 수 있다. 코드로 나타내면 다음과 같다. for model in best_models: (...) for idx, sample in enumerate(test_data_loader): with torch.no_grad(): (...) probs = model_bone(images) preds = (probs > 0.5) batch_idx = batch_size * idx # im.. 더보기 Trouble Shooting Pycharm에서 경로를 못 찾을 경우 - 가상환경에서 OpenCV를 설치하였으나, 경로 읽어오지 못할 경우 - e.g. C:\Users\jhon\anaconda3\envs\torch\Library\bin - Console > Python Console > 환경 변수에 직접 추가해 주면 된다. - 파이참 2020버전에서는 문제가 발생하진 않지만, 다른 컴퓨터 2018버전에서는 이런 문제가 발생한다. RuntimeError: freeze_support() Error 해결 방법 aigong.tistory.com/136 torch.load(model)에러 모델 저장시에 torch.save(model) 로 모델 아키텍쳐 전체를 저장하는 것이 아니라, 가중치 만을 저장하는 것을 권장한다. torch.save(mo.. 더보기 Torch 데이터셋 & 데이터 로더 + Transforms 목차 TORCH.UTILS.DATA.DATASET TORCH.UTILS.DATA.DATALOADER TORCHVISION.TRANSFORMS ※ 파이토치를 이용한 딥러닝 구현 흐름 TORCH.UTILS.DATA.DATASET Pytorch는 Dataset 클래스를 상속 받아 Custom Dataset 클래스를 만들게 한다. class Dataset(object): """An abstract class representing a Dataset. All other datasets should subclass it. All subclasses should override __len__, that provides the size of the dataset, and __getitem__, suppo.. 더보기 Torch 연산 torch.flatten(input, start_dim=0, end_dim=-1) → Tensor >>> t = torch.tensor([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]) >>> torch.flatten(t) tensor([1, 2, 3, 4, 5, 6, 7, 8]) >>> torch.flatten(t, start_dim=1) tensor([[1, 2, 3, 4], [5, 6, 7, 8]]) (계속 정리...) 더보기 Pytorch with examples ※ 아래 글은 Pytorch 홈페이지의 pytorch_with_examples를 번역 및 요약한 것입니다. 1. Numpy vs Pytorch 사인함수(sin)를 numpy 와 pytorch를 이용해 Linefitting 하면서 두 프레임 워크를 비교해 본다. 먼저 LineFitting을 위해서 모델링을 먼저 한다. 본 예제에서는 3차원 다항식으로 sin 함수를 Linefitting 을 시도한다. y=dx3+cx2+bx+d 2. Numpy 아래는 Numpy로 sin 함수 Linefitting 하기 위한 코드와 결과이다. 아래 그림을 보면, 3차원으로 다항식 가정을 하였고, 추정치가 실제 sin 함수와는 다소 차이를 보인다. 하지만, 계산 그래프를 통해서 계수(coefficient.. 더보기 이전 1 다음