본문 바로가기

python

(27)
python jupyter code, scripts 복구 from memory, 메모리 변수로 부터 코드 복구 %history -g를 쓰면 된다. https://softhints.com/6-ways-recover-deleted-jupyter-notebook-including-jupyterlab/ 6 ways to Recover deleted Jupyter Notebook (including JupyterLab) - Softhints In this tutorial, we'll see how to recover deleted cells and restore previous sessions of Jupyter Notebook. We'll also see how to restore an accidentally deleted notebook. Step 1: Jupyter Notebook restore deleted cel..
[centos] dlib install error, C++11 is required to use dlib, but the version of GCC you are using is tooold and doesn't support C++11. You need GCC 4.9 or newer. 에러 해결법 문제점1 문제점2 https://hidden-loca.tistory.com/6 [Python] dlib 설치하기. 2021. 03. 17 수정 근 수개월 동안 가장 많은 페이지 방문이 있었지만, 내용상 대충대충 써 내린 부분이 많아 새로 수정. - 가상환경생성 dlib을 설치할 가상환경을 만들었습니다. 가상환경이름은 dlib hidden-loca.tistory.com 위 방법대로 했는데도 안됐다. C++11 is required to use dlib, but the version of GCC you are using is too old and doesn't support C++11. You need GCC 4.9 or newer. conda install dlib 위 명령어는 안됨... 해결책 conda..
[mac os] matplotib 사용시 font 한글 폰트 깨짐 현상 해결법 import matplotlib.pyplot as plt import matplotlib as mpl import seaborn as sns mpl.rcParams['axes.unicode_minus'] = False plt.rcParams['font.family'] = 'NanumBarunGothic' plt.rcParams['font.size'] = 14.5 plt.rcParams['figure.figsize'] = (14,4) 대부분 이를 사용하면 해결된다.
[jupyter notebook, lab] IProgress not found. 에러 해결법 pip install ipywidgets 하고 jupyter lab 혹은 jupyter notebook을 재실행시켜준다.
[postman] postman 이용해서 post 쿼리 날려보기. 에러 the request Content-Type was not 'application/json'. post 방식으로 포스트맨 이용해서 flask 웹서버에 쿼리를 날리고 있었다. 그런데 자꾸 이런 에러가 뜨는 상황 문제점 문제는 내가 postman이란 프로그램을 처음 사용해봐서 생기는 것 같았다. Did not attempt to load JSON data because the request Content-Type was not 'application/json'. the request Content-Type was not 'application/json'.로 보아 날려주는 내용이 json 형태가 아님을 확인 해결책 postman 관련 검색을 통해 해결할 수 있었다. 이런식으로 POST 방식을 선택하고, Body를 누른뒤 raw부분으로 json 데이터 형식으로 데이터를 전송해주면 된다. 간단하다! htt..
[mac os] 한글 자음 모음 분리 문제 in python3 [(df['광고 소재 이름'][0][x], image_path[6].split('/')[-1][x], df['광고 소재 이름'][0][x]==image_path[6].split('/')[-1][x]) for x in range(len(df['광고 소재 이름'][0]))] 한쪽엔 건강메인을 '건', '강', '메', '인' 이라고 읽는데... 다른쪽에선 'ㄱ', 'ㅓ', 'ㄴ' ...이런 식으로 읽는다!!! 이럴 수가.. 어떻게 해결할까? 문제 원인은 MAC에서 한글 인식을 WINDOWS와 다르게 한다는 데에 있다. 해결 방법은 간단했다. import unicodedata string = '파이썬' string = unicodedata.normalize('NFC', string) print(string[0..
[opencv-python] 이미지 boundary detection, rectangle detection 이미지내 객체 사각형 테두리 만들기 일단 이미지를 불러옵니다. 이미지에서 한자 글자 외부에만 사각형을 빨간 테두리로 치는게 목표입니다. 한자 글자 사이사이 띄어진 여백때문에 경계가 나눠질 수도 있으므로 블러를 해줍니다. 여백이 너무 적어보여 여백을 추가해서 보다 실전에 가깝게 만들어줍시다. cv2.connectedComponentsWithStats를 이용해서 해당 영역의 x, y, w, h 좌표를 구합니다. 그리고 cv2.rectangle을 이용해서 이를 그려줍니다. 전체 코드는 아래에!! image = (plt.imread('dataset/茄/茄 22.png') * 255.).astype(np.uint8) image = cv2.resize(image, (256, 256)) plt.imshow(image) blur = cv2.Gaussia..
librosa.load와 scipy.sio.wavefile read가 다른 점 librosa의 normalization 방법 scipy.sio.wavefile.read를 쓰면 int16으로 값을 읽어들인다. 즉 2바이트 librosa.load를 쓰면 float32, 4바이트로 값을 읽어들인다. 오잉?? 대체 뭘까 궁금해서 조사해봤다. 평균과 min, max를 조사해보니 왠지 표준 정규화를 해준것 같아서 그대로 해주어보았다. 오잉 값이 다르다.... 이러면 안되는데?? 그러면 방법은... librosa.load를 뜯어 분해하는 수 밖에 없다... 그렇게 찾아낸 함수가 아래함수!! 위 함수를 쓰니 결과는? 같다. 이 함수를 이용하자. https://librosa.org/doc/main/generated/librosa.util.buf_to_float.html librosa.util.buf_to_float — librosa 0.9.0..

728x90