일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- torch
- 정보처리기사
- 실기
- 기사시험
- Anaconda
- ubuntu
- Python
- 로지텍
- qnet
- 우분투
- 큐넷
- 정보처리
- 코딩
- 국가자격증
- 정보처리기사 실기
- 딥러닝
- 실기시험
- Logitech
- NCS
- 파이토치
- DEEPLEARNING
- coding
- python3
- keyboards
- 기사 실기
- Apple
- 2020정보처리기사
- 자격증
- 파이썬
- pytorch
- Today
- Total
목록파이썬 (6)
dhwiii's notepad | 딥 러닝, 코덱 일기장
케라스를 사용하기 위해 import keras를 했더니 나타났던 오류 입니다. AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects' 기존에 확인을 하려던 파이썬이 3.7버전이었는데, Keras 공식 홈페이지에서 Compability를 확인해보니 파이썬 버전이 3.6까지 지원했기에, 나타났던 오류였습니다. Stackoverflow에서는 keras 대신 tensorflow.keras를 import해서 오류를 고친 경우도 있었습니다.

파이토치의 모델 구조를 볼 수 있는 torchinfo라는 라이브러리가 있다. 아래와 비슷한 구조로 사용하며, pip install torchinfo from torchinfo import summary model = LeNet() summary(model,(1,1,3,3)) torchinfo 내에서 사용되는 파라미터는 다음과 같다. summary(model, input_size, input_data, batch_dim, col_names, col_width, depth, device, dtypes, row_settings, verbose, **kwargs)

import torch print(torch.__version__) cmd 명령창이라면 python을 입력한 후 위의 명령을 사용하면 파이토치의 버전을 알 수 있다.
파이썬 파이토치 에러입니다. IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number 파이썬 파이토치의 버전이 0.5 이전 버전을 사용하게 되면 해당 에러가 나타나게 되는데, [변경 전] generator_adversarial_loss.data[0] -> [변경 후] generator_adversarial_loss 이런 식으로 제일 뒤에 있는 [0]을 지워주시면 해결 됩니다. 참고 : github.com/NVIDIA/flownet2-pytorch/issues/113
import cognitive_face as CF KEY = 'PERSONAL_KEY' # Replace with a valid subscription key (keeping the quotes in place). CF.Key.set(KEY) BASE_URL = 'https://koreacentral.api.cognitive.microsoft.com/face/v1.0' # Replace with your regional Base URL CF.BaseUrl.set(BASE_URL) # You can use this example JPG or replace the URL below with your own URL to a JPEG image. img_url = 'PERSONAL_IMG' #img_url ha..
import cv2 import sys import os CAM_ID = 0 capture = cv2.VideoCapture(0) def capture(camid = CAM_ID): cam = cv2.VideoCapture(camid) if cam.isOpened() == False: print ('cant open the cam (%d)' % camid) return None ret, frame = cam.read() if frame is None: print ('frame is not exist') return None cv2.imwrite('test.jpg',frame, params=[cv2.IMWRITE_JPEG_QUALITY,100]) cam.release() if __name__ == '__m..