Study

    [백준] 9663번 : N-Queen (Python)

    코드의 구현 자체는 간단하다. DFS를 돌면서, 조건에 맞도록 구현하면 된다. 발목을 잡았던 부분은 바로 시간초과였다. 15 * 15의 경우 상당한 연산 시간이 필요하기 때문으로 보인다. 이미 이전의 퀸들이 있는 곳은 제외하고 넘어가도록 해야 최대한 시간을 아껴야 통과할 수 있다. 결국 PyPy3에서는 성공했지만, Python3에서는 여전히 시간초과가 발생했다. Python3에서도 성공하려면 뭔가 다른 방법이 필요할 것으로 보이지만, 시간이 아까우니 패스. import sys N = int(sys.stdin.readline()) row = [0] * N cnt = 0 visit = [False] * N # Queen이 서로 공격할 수 없는 지 확인 def check(q): for i in range(q)..

    Deep Learning Library for video understanding

    Representative Library for video understanding facebookresearch/PyTorchVideo [github] open-mmlab/MMAction2 [github] paddlepaddle/PaddleVideo [github] Compare Libraries PyTorchVideo MMAction2 PaddleVideo Support Model - Slow & SlowFast - X3D - MViT - Slow & SlowFast - X3D - TimeSformer - BMN - PoseC3D - PP-TSM - AGCN - TimesFormer - BMN - AttentianLSTM Feature - Support Accelerator for optimizing..

    [백준] 5430번: AC (Python)

    문제는 어렵지 않으나, 입출력을 약간 번거로운 편인 문제. import sys from collections import deque for test_case in range(int(sys.stdin.readline())): error = False command_list = sys.stdin.readline().strip() num_cnt = int(sys.stdin.readline()) num_list = deque(sys.stdin.readline().strip()[1:-1].split(",")) if num_cnt == 0: num_list = deque() for command in command_list: if command == "R": num_list.reverse() else: if num..

    Knowledge Distillation 구현

    What is Knowledge Distillation? 모델의 경량화의 방법 중 하나인 Knowledge Distillation. 이는 Pseudo Labeling과는 약간은 다른 개념이다. Pseudo Labeling의 경우에는 라벨이 없는 데이터를 잘 학습된 모델을 사용하여 추가적인 데이터(hard label)로 학습하는 것이라면, Knowledge Distillation은 잘 학습된 모델의 경향성(soft label)을 배우는 것이다. 여기서 말하는 경향성이란, 예측 결과로 나온 라벨을 얼마나 그 라벨이라고 생각하고 나오는 것인가를 학습한다는 의미 한다고 볼 수 있다. (자세한 내용은 이전 게시글 2021.10.22 - [Study/AI] - Why Knowledge Distillation Wor..

    [Pytorch] Tips for Loading Pre-trained Model

    The following errors may occur while loading a pre-trained model. RuntimeError: Error(s) in loading state_dict for model: Missing key(s) in state_dict: ~~~~ Unexpected key(s) in state_dict: ~~~~ Occurs when the key is not sufficient or the key name does not match. Setting "strict" as "false" can easily resolve this error. model.load_state_dict(checkpoint, strict=False) For more detail check docu..

    [백준] 10828번: 스택 (Python)

    풀이 import sys cnt = int(sys.stdin.readline()) stack = [] for i in range(cnt): command = sys.stdin.readline().split() if command[0] == "push": stack.append(command[1]) elif command[0] == "pop": if len(stack): print(stack.pop()) else: print(-1) elif command[0] == "size": print(len(stack)) elif command[0] == "empty": if len(stack): print(0) else: print(1) elif command[0] == "top": if len(stack): pr..

    [백준] 1920번: 수 찾기, 10815번: 숫자 카드 (Python)

    풀이 import sys from collections import Counter N = int(sys.stdin.readline()) N_list = list(map(int, sys.stdin.readline().split(' '))) M = int(sys.stdin.readline()) M_list = list(map(int, sys.stdin.readline().split(' '))) N_cnt = Counter(N_list) for num in M_list: if N_cnt[num]: print(1) else: print(0) split( )으로 input을 받아주는게 포인트 나는 몇개인지 출력하는지 알고 Counter를 사용했다. 단순히 중복 여부라면 더 가벼운 코드로 구현하지만... 통과했으니..

    Lightweight Deep Learning

    모델 경량화의 필요성 경량화란 모델의 기존의 성능을 유지한채 더 적은 파라미터 수와 연산량을 가지는 모델을 만드는 것이다. 그렇다면 왜 경량화가 필요할까? AI 모델 학습에 들어가는 연산은 시간이 지나면서, 기하급수적으로 증가하고 있다. 또한 AI를 산업에 적용되기 위해서는 다양한 요구조건들이 고려된다. 이러한 상황에서 동일한 조건으로 최대의 결과를 얻기 위해서는 모델의 경량화/최적화 과정이 필요하다. 대표적인 경량화/최적화의 종류 네트워크 구조 관점 Efficient Architecture Design Network Pruning Knowledge Distillation Matrix / Tensor Decomposition Hardward 관점 Network Quantization Network Com..