no image
mmdetection 으로부터 학습한 모델을 ONNX 및 TensorRT 로 변환 시 나타나는 문제
mmdetection 으로부터 학습한 딥러닝 모델을 ONNX 모델로 변환하고, TensorRT 로 변환하는 과정에서 아래와 같이 importTopK 레이어(노드)를 TensorRT 에서 인식을 못하여 변환이 안되는 문제가 발생하였다. In node -1 (importTopK): UNSUPPORTED_NODE: Assertion failed: inputs.at(1).is_weights() ERROR: builtin_op_importers.cpp:3455 In function importTopK: [8] Assertion failed: inputs.at(1).is_weights() mmdetection 에서는 아래와 같이 여러 TensorRT Plugin 을 제공하고 있다. 아마 이 플러그인들을 처리하는 과..
2021.07.26
no image
fatal error: libpq-fe.h: No such file or directory
아래와 같은 에러 발생 시 libpq-dev 패키지를 설치해주면 해결된다. fatal error: libpq-fe.h: No such file or directory $ sudo apt-get install libpq-dev 위와 같이 설치를 진행했는데 아래와 같이 dependency 문제가 나온다면, 해당 패키지를 dependency 에 맞게 재설치 해준다. The following packages have unmet dependencies: libpq-dev : Depends: libpq5 (= 10.3-1) but 13.3-1.pgdg18.04+1 is to be installed Reading package lists... Done Building dependency tree Reading sta..
2021.07.15
Image Classification 시 분류 결과 한쪽에 치우쳐져서 나오는 현상
weight 파일을 load 하지 않고 테스트 시 model 구조만 불러와서 inferece 하기 때문에 분류 결과는 class A : 0.54, class B : 0.46 이런식의 값이 산출되게 된다. 반드시 weight 파일을 load 할 때 path 를 잘 지정해주어야 하며, (예외 처리도 반드시 해야함) load_state_dict(checkpoint['state_dict'] 을 꼭 해주어야한다.
2021.07.01
no image
[Linux] Code Blocks 설치하기
1. Code Blocks 리눅스 버전 설치하기 (~/Downloads) https://www.codeblocks.org/downloads/binaries/#imagesoslinux48pnglogo-linux-32-and-64-bit Binary releases www.codeblocks.org 2. 압축 풀기 cd ~/Downloads tar -xf codeblocks_20.03_amd64_oldstable.tar.xz 3. 설치 sudo dpkg -i *20.03*.deb sudo apt-get install -f 4. 실행 codeblocks 참고자료 : https://askubuntu.com/questions/1030720/how-to-install-latest-codeblocks-from-tar..
2021.07.01
no image
[ONNX] Pytorch 모델을 ONNX 모델로 변환 할 때 dynamic_axes 지정하는 방법
LSTM 같은 모델을 ONNX 모델로 변환할 경우, 이 모델은 입력 값을 동적으로 설정할 수 도 있기 때문에 ONNX 모델로 export 시 dynamic_axes 를 설정하여 동적인 입력 값을 갖는 ONNX 모델로 변환할 수 있다. torch 공식 문서에 나와있는 내용은 다음과 같다. dynamic_axes (dict or dict, default empty dict) – a dictionary to specify dynamic axes of input/output, such that: - KEY: input and/or output names - VALUE: index of dynamic axes for given key and potentially the name to be used for expo..
2021.06.29
no image
Linux 환경에서 OpenCV의 VideoCapture 사용 시 Webcam이 죽어도 읽히지 않을 때
아래와 같은 식으로 Linux 환경에서 OpenCV(C++)의 VideoCapture 클래스를 사용하여 Webcam을 사용하고자 할 때 웹캠이 read 되지 않는 문제가 있다. VideoCapture cap; // open the default camera using default API cap.open(0); 그럴 땐 먼저 웹캠 USB가 제대로 꽂혀있는지 확인한 뒤, 디바이스가 제대로 연결 되었는지 아래와 같이 확인해보고, ffplay를 사용하여 웹캠이 정상 동작하는지 확인해본다. 그 전에 연결되어있는 카메라의 device 명을 아래와 같이 확인해야한다. $ v4l2-ctl --list-devices ffplay를 사용하여 연결되어있는 Webcam 을 테스트 하는 명령어는 아래와 같다. $ ffplay..
2021.06.25
Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should be the same
아래와 같은 에러시 RuntimeError: Input type (torch.cuda.DoubleTensor) and weight type (torch.cuda.FloatTensor) should be the same x = x.to(device).float() .float() 사용하여 해결한다. 참고자료 : https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=chrhdhkd&logNo=221469768189 pytorch : RuntimeError 발생시 해결방법(Input type and weight type should be the same) 발생한 에러 : RuntimeError: Input type (torch.cuda.Dou..
2021.06.24
[C++] vector 최댓값, 최솟값, 인덱스 구하기
vector 컨테이너에서 최대값, 최소값을 구할 경우 for문을 작성할 수도 있지만, 복잡하기 때문에 algorithm 라이브러리의 있는 max_element를 사용하여 한줄로도 간단하게 최대값을 구할 수 있다. 또한, max_element를 사용하면 최대값의 인덱스 값을 구할 수 있으며, 최소값을 구하기 위해서는 min_element를 사용한다. max_element의 결과로 최대값을 가리키는 반복자를 반환하기 때문에 이를 * 연산자를 사용하면 최대값을 구할 수 있다. 또한, vector는 일련의 반복자로 구성되어 있으므로 최대값을 가리키는 반복자를 맨 처음을 가리키는 v.begin()만큼 빼준다면 인덱스 값을 구할 수 있다. vector와 유사한 구조인 deque에서도 동일하게 이용할 수 있다. #i..
2021.06.18
no image
Ubuntu 18.04 환경에서 VNC Server 설정했을 때 회색 화면 나타나는 문제
아래와 같이 vnc server 를 연결했을 때 회색 화면으로 뜨는 문제가 발생한다. 실행될 Application 이 아무것도 없어서 뜨는 문제이다. ~/.vnc/xstartup 파일을 수정해주면 된다. 0. process kill 해당 번호를 지워주면 된다. vncserver -kill :2 1. 패키지 설치 sudo apt install gnome-session-flashback 2. ~/.vnc/xstartup 내용 변경 vi ~/.vnc/xstartup #!/bin/sh # Uncomment the following two lines for normal desktop: # unset SESSION_MANAGER # exec /etc/X11/xinit/xinitrc [ -x /etc/vnc/xsta..
2021.06.11
[ffmpeg] Linux에서 ffmpeg 으로 m3u8 URL 동영상 저장하기
ffmpeg -i "URL" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 file.mp4 참고자료 : https://www.vividian.net/2020/09/42 m3u8를 mp4로 변환 (ffmpeg 이용) – vividian repository www.vividian.net
2021.06.04
no image
[Linux] 심볼릭 링크(symbolic link) 설정하기
필자는 CUDA 버전을 2개를 사용중이기 때문에 (CUDA 10.2 / CUDA 11.1) 심볼릭 링크를 설정하여 버전을 관리하고 있다. 심볼릭 링크란? 컴퓨팅에서 심볼릭 링크(symbolic link) 또는 기호화된 링크는 절대 경로 또는 상대 경로의 형태로 된 다른 파일이나 디렉터리에 대한 참조를 포함하고 있는 특별한 종류의 파일이다. 심볼릭 링크는 이미 1978년까지 DEC와 데이터 제너럴의 RDOS의 미니 컴퓨터 운영 체제에 존재했다. 오늘날 이들은 FreeBSD, GNU/리눅스, OS X과 같은 대부분의 유닉스 계열 운영 체제인 POSIX 운영 체제 표준과 윈도우 비스타, 윈도우 7, 또 바로 가기 파일의 형태로서 윈도우 2000, 윈도우 XP에 이르는 윈도 운영 체제를 통해 지원되고 있다. 심..
2021.05.25
no image
[Python] google images download 이용하여 구글 검색 이미지 저장하기
자신의 크롬 버전에 맞는 chromedriver 를 다운로드 해주고, 아래와 같이 git clone 하여 google images download 프로젝트 다운로드 한 뒤 사용하면 된다. $ git clone https://github.com/ultralytics/google-images-download $ cd google-images-download $ python3 bing_scraper.py --search 'cat' --limit 10 --download --chromedriver ./chromedriver 참고로 chromedriver 다운로드는 아래에서 하면 된다. https://chromedriver.chromium.org/downloads ChromeDriver - WebDriver fo..
2021.05.20