본문 바로가기

전체 글345

[DL] Save and Load model on Keras 이번 포스팅에서는 Keras를 이용해서 훈련한 모델을 저장하고 다시 불러와서 사용하는 방법을 알아보겠습니다. 일단 모델이 필요하니, 이전에 만들어 두었던 모델을 한 번 활용해 봅시다. 2020.11.10 - [DeepLearning] - Classifying Handwriting with Keras Save and Load Weights 먼저 가중치를 저장하고 불러오는 것을 알아보겠습니다. 다음의 코드를 사용하면 간단하게 우리가 훈련시킨 가중치들을 따로 저장을 할 수가 있습니다. model.save_weights('weights.h5') 각자 원하는 이름을 사용하시면 해당 이름으로 저장이 됩니다. 참고로 h5 확장자를 사용할 경우 HDF5 format을 사용하여 저장됩니다. 저장된 가중치를 불러와 모델에.. 2021. 4. 5.
[Mac] Tip: Resolving xcrun error Terminal에서 작업을 하다보면, 다음과 같은 에러를 만날 때가 종종 있습니다. xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun xcode의 command line도구 관련 문제인데, 보통 새로 설치를 해주면 문제가 해결됩니다. $ xcode-select --install 이미 설치가 되어있는데, 경로가 꼬여서 경로를 재설정 하고 싶다면 다음의 명령어를 입력해주면 됩니다. $ xcode-select --reset 단축 옵션으로 -r을 사용할 수 있습니다. 임의의 경로를 직접 설정해 .. 2021. 4. 3.
[TypeScript] Template Literal Types Template Literal Types build on string literal types, and have the ability to expand into many strings via unions. They have the same syntax as template literal strings in JavaScript, but are used in type positions. When used with concrete literal types, a template literal produces a new string literal type by concatenating the contents. type TypeA = "AAA"; type TypeBC = "BBB" | "CCC"; type Type.. 2021. 3. 21.
[TypeScript] Utility Types TypeScript provides several utility types to facilitate common type transformations. ConstructorParameters type ConstructorParameters any> = T extends new (...args: infer P) => any ? P : never; Constructs a tuple or array type from the types of a constructor function type. It produces a tuple type with all the parameter types (or the type never if Type is not a function). Exclude type Exclude = .. 2021. 3. 21.
정규 표현식 (Regular Expression) 개인적으로는 개발을 하면서 매일같이 정규표현식을 사용하고 있습니다. 주위 동료나 후배들에게도 배워둘 것을 권하고요. 가장 많이 사용하는 것을 역시 검색 혹은 치환을 할 때입니다. 가장 자주 사용하는 VS Code 툴도 정규표현식으로 검색을 지원하고 있고, vim이나 기타 Linux 상에서 검색 등에서도 자주 사용을 하죠. 또, crawling 혹은 scraping 등을 할 때도 자주 사용되니 꼭 익혀두시길 권합니다. 정규표현식의 공식적인 표준은 없는 것으로 알고 있습니다. 가장 널리 사용되는 것은 PCRE이지만, 각각의 툴, 언어 등에 따라 약간씩 차이가 있을 수 있습니다. 기본적인 내용은 거의 공통적으로 사용되니 하나만 배워 두시면 쉽게 다른 곳에서도 적응해서 사용하실 수 있습니다. Syntax 그러면.. 2021. 3. 6.
[Git] Tip: Revert Merged Commit 우리는 때로 되돌렸다는 기록을 남기면서 commit을 되돌려야할 때가 있습니다. 이럴 때, revert 명령을 사용하게 되죠. 하지만, 되돌릴 커밋이 merged commit일 때가 문제죠. 2개의 commit이 병합되어있을 경우, 되돌릴 때 어떤 commit으로 되돌려야할 지가 문제죠. 이제 이 문제를 하나씩 살펴봅시다. Merged | \ C B | / A 위와 같은 상태에서 merged commit을 revert해 봅시다. $ git revert 이런 식으로 명령을 내리면 git이 명령 수행을 할 수 없다고 불평을 합니다. 당연한 일이죠. 되돌렸을 때, C로도 갈 수 있고, B로도 갈 수 있기 때문입니다. 이럴 때, -m 옵션을 사용할 수 있습니다. 쉽게 말해 revert 후, 어느 쪽을 따라 갈까.. 2021. 3. 5.
[C] Get return address of functions (__builtin_return_address) Let's get the return address of a function with __builtin_return_address. Syntax void* __builtin_return_address(unsigned int level); level 0 : Return the address of the current function 1 : Return the address of the caller of the current function 2 ~ 63 : Return the address of the caller's caller, and so forth If the top of the call stack has been reached, the function will return 0. It is usual.. 2021. 3. 2.
[Flask] Using Markdown on Flask In this posting, I'll show you how to use markdown on Flask. Installation $ pip install flask flask-markdown flask-simplemde Install Flask and Flask-Markdown, Flask-SimpleMDE. Create an Application 2020/10/11 - [Python] - [Python] Getting Started with Flask app.py from flask import Flask, render_template app = Flask(__name__) @app.route("/") def index(): return render_template("index.html") if _.. 2021. 3. 1.
[Flask] Send Email on Flask using Flask-Mail In this posting, we will figure out how to send an email on Flask. Installation First of all, we need flask and flask-mail. $ pip install flask flask-mail Create Flask Application Now, it's Flask time. You can refer to the basics of Flask in the below links. 2020/10/11 - [Python] - [Python] Getting Started with Flask 2020/10/23 - [Python] - [Python] Templates Static Files in Flask app.py from fl.. 2021. 2. 28.