본문 바로가기

전체 글136

[논문리뷰 : 개념] In-flight positional and energy use data set of a DJI Matrice 100quadcopter for small package delivery 논문 링크 : https://arxiv.org/abs/2103.13313 In-flight positional and energy use data set of a DJI Matrice 100 quadcopter for small package delivery We autonomously direct a small quadcopter package delivery Uncrewed Aerial Vehicle (UAV) or "drone" to take off, fly a specified route, and land for a total of 209 flights while varying a set of operational parameters. The vehicle was equipped with onbo.. 2024. 1. 2.
[Pytorch 스크래치 코드] Evaluation 코드 ❏ Evaluation code ✓ train, validation 을 통한 early stopping을 수행하였으면 나온 모델을 통해 실제 예측을 수행해야하는 마지막 단계에 도달한다. 이를 위해 아래와 같이 코드를 적용하면 된다. ### Evaluation code ### ### ### # 예측값 저장하는 빈 리스트 all_predictions = [] # 모델을 평가모드로 설정. model.eval() for inputs in test_dataloader: with torch.no_grad(): inputs=inputs[0].float() x = inputs.to(device) outputs = model(x) max_values, max_indices = torch.max(outputs, 1) # .. 2023. 12. 28.
[파이썬 디버거] import pdb;pdb.set_trace() 용도: visual studio 로 c언어를 작성해본적이 있다면 빨간점을 클릭하면 그 부분에 대해서 자세히 들어가며 디버깅을 할 수 있다. 사용 : Visual studio code 의 ipynb 확장자로 코드를 작성후 디버깅하고 싶은 부분에 import pdb;pdb.set_trace() 를 추가하면 새로운 창이 나온다. 그 줄을 기준으로 이전의 변수, 값 들은 다 할당을 받은 상태임. visual studio 의 디버깅 기능과 동일하다 보면 됨. 사용법 : 창이 나오면 n (next), q(quit), s(step) 등의 명령어를 통해 진행할 수 있다. n를 사용하면 다음줄로 넘어가고, s로 하면 그 단계에서 있는 내부 함수등으로 들어가고 q를 하면 종료 된다. 이것외에도 명령어가 있는데 공식 문서를.. 2023. 12. 27.
[형변환] Tensor to Numpy / Numpy to Tensor . Numpy → Tensor output = torch.Tensor(input) # 새로운 메모리에 할당. output = torch.from_numpy(input) # 기존 메모리에 할당. (where input is Numpy type, output is Tensor type) 2. Tensor → Numpy output= np.array(input) (where input is Tensor type, output is Numpy type) (암기도 하려고 노력해야 외워진다.) 2023. 12. 23.
[1차원 추가 및 제거] Pytorch squeeze / unsqueeze 상황: 딥러닝을 하다보면 1차원을 추가 및 제거를 위한 단계가 필요하게 된다. 1. squeeze : 1차원 제거 역할. import torch x= torch.ones(5,4,1,4,1) x1 = x.squeeze() # 모든 1차원 제거 print(x1.size()) # torch.Size([5, 4, 4]) x2= x.squeeze(dim = 2) print(x2.size()) # torch.Size([5, 4, 4, 1]) x3= x.squeeze(dim = -1) # dim=4 와 같음 print(x3.size()) # torch.Size([5, 4, 1, 4]) x4= x.squeeze(dim = 1) # 잘못된 차원 삭제 불가능. print(x4.size()) # torch.Size([5, .. 2023. 12. 23.
[Cross entropy] 크로스 엔트로피의 index 값은 0부터 시작이다. 문제 발생 : kaggle에서 과제를 진행하는데 자꾸 에러가 뜨는것이다. 정확히 기억은 안나는데 type이 안맞다고....근데 print를 찍어보면 심지어 문제없이 잘 나오는것이다.....(조교한테 질문함) 문제 상황 : 딥러닝 학습에서 loss 값은 y_predict 와 y_ground truth 값으로 계산을 수행한다. 하지만 y_ground truth 값 즉, index( label)의 값이 항상 0부터 시작하지는 않는다. 문제 해결 : index(label) 이 항상 0 부터 시작해야함. 즉, 1부터 시작하는 label 이라면 -1을 해서 0 부터 시작 지점을 만들어야 함. (아래 사진을 보면 class indices in the range [0 ,C) 라고 명시되어 있다.) 2023. 12. 23.