AI, Deep Learning Basics

    [3D Geometry] 1. 3D Representations: Types / pros and cons / Conversion between different types

    이 글은 성민혁 교수님의 CS479: Machine Learning for 3D Data (Fall 2023)을 듣고 (필자의 이해를 위해) 정리한 글입니다. Intro: Application of 3D data 3D Generation (e.g., used for simulator, games) 3D Reconstruction (e.g., AR/VR) 3D Perception (e.g., waymo, home-environment) Types of 3D Representations We are interested in 2D surfaces in 3D space. Explicit representations 3D Grid (Voxels): 3D 창 Multi-view images Point cloud C..

    Build OpenCV with CUDA in virtual environment

    To make OpenCV work with CUDA support in a specific conda environment, you need to build OpenCV from source within that environment. Here's a step-by-step guide: 1. Setup Your Conda Environment: If you haven't created the environment yet: ```bash conda create --name [YOUR ENV NAME] python=3.8 ``` Activate your environment: ```bash conda activate [YOUR ENV NAME] ``` 2. Install Dependencies: Withi..

    Training Tips for the Transformer Model

    This article is the summary for Training Tips for the Transformer Model and Advanced Techiniques for Fine-Tuning Transformers. Training data preprocessing A higher batch size my be beneficial for the training and the batch size can be higher when excluding training sentences longer than a given threshold. It may be a good idea to exclude too long sentences. Training data size Comparing different..

    Training on GPU, CPU

    이 사이트를 꼭 읽자. Training을 할 때 눈 여겨보아야 할 점은 bottleneck이 있는지이다. 즉, GPU와 CPU가 balance있게 잘 퍼졌는지 확인해야 한다는 점이다. CPU와 GPU 모두 RAM이 존재한다. CPU (RAM): 주로 serial 계산을 처리 GPU (DRAM, VRAM): matrix multiplication을 하는 역할을 한다. GPU Bottleneck (Hardward 문제) Hardward의 thread가 모자르다. -core가 모자르다. Thread를 사용할 Tensorcore 부족 Memory transfer 하드웨어 -> RAM, RAM -> GPU memory, GPU memory -> shared memory: 크게 3단계로 나뉘는데, 상위 단계로 보낼..

    (작성중) [AI602] 3. Bayesian Deep Learning

    1. Bayesian Machine Learning Posterior inference 2. Bayesian Deep Learning How: Variational inference Markov Chain Monte Carlo (MCMC) Sampling Bayes by Backprop 3. Bayesian Approximation 4. Appolication) Meta-learning: Neural Processes

    [AI602] 2. Self-supervised Learning

    Self-supervised learning is an unsupervised learning strategy to learn transferable representations by solving data-generated tasks (pretext tasks). It also learns a good representation without supervision, and implements other tasks. The model is evaluated by stacking a task-specific layer. 결국에는, SSL은 어떤 objective를 해결하기 위해서 1. pretext task에는 기존의 dataset에서 반대의 representation을 만들어서 적용하는 방식. 이후에, ..

    [AI602] 1. Vision Transformer

    Transformer: an all-attention model for encoder-decoder framework without any recurrences or convolutions. Attention Self-attention (문장 내에서의 연결) Scaled dot-product attention (with keys, values, and queries). Self-attention learns to encode a word at a certain position by learning what other words to focus on to better understand it. Done via matrix computations, which are fast to compute using G..

    [AI602] AdvancedML Introduction

    Vision Transformer Self-supervised Learning Bayesian Deep Learning

    [생각노트] GPT-3 / Chain of thoughts: InstructGPT

    이 글은 필자가 NLP를 하면서 조금씩 배운 내용을 적은 [생각노트] 시리즈 중 하나입니다. 내용이 맞지 않을 수 있다는 점 참고하세요. Transformer --> GPT-3 GPT-3 Dataset: CommonCrawl, WebText2 (from web pages), Wikipedia, Books1, Books2 (a large collection of free novel books written) Chain of thoughts ex. InstructGPT, Step by step Zero-shot이나 Few-shot이 존재한다.

    [Logger] wandb 사용법

    본 글은 필자의 이해를 돕기 위해 작성된 글로 TensorboardX를 Pytorch에서 구동하는데 일련의 과정을 적은 글입니다. 참고자료1 wandb: tensorboard와 마찬가지로 모델의 파라미터나 accuracy, loss를 기록하는데 유용한 도구 On terminal) wandb login, init pip install wandb wandb login # then put your api key by accessing this link: https://app.wandb.ai/authorize wandb init # set the configuration information ex. entity, project name wandb.init (configuration for model) wandb..

    [CS182 Sergey Levine] Deep Learning - NLP Basics

    Goal: Check how sequential processing might be possible for robots Contents 4h 43m Lecture 10. Recurrent Neural Networks 1h 25m Lecture 11. Sequence to Sequence 1h 11m Lecture 12. Transformers 1h 4m Lecture 13. NLP 1h 3m

    Instance segmentation COCO Evaluation metric

    본 글은 Instance segmentation task의 evaluation metric (평가 척도)인 COCO evaluation metric을 설명한 글입니다. COCO dataset은 여기서 볼 수 있습니다. On the instance segmentation task, its evaluation metric solves this problem by using the intersection over union (IoU). IoU means measuring the similarity between finite sets, defined as the size of the intersection divided by the size of the union of the sets. Based on the ..

    [Generative Model] Latent Variable model

    이 글은 Generative model 에 대한 필자의 이해를 높이고자 작성된 글입니다. 참고자료는 자료1 입니다. Latent variable model(LVM) defines a distribution over observation $x$ by using a (vector) latent variable $z$(: as an explanation for the observation)and specifying: The prior distribution $p(z)$ for the latent variable The likelihood $p(x|z)$ that connects the latent variable to the observation The joint distribution $p(x, z) = p..

    Methodology skeletons

    AI skeletons Supervised model Self-supervised model Unsupervised model Generative models Autoregressive models RNN & Transformer language models, NADE, PixelCNN, WaveNet Latent variable models Tractable: e.g. invertible / flow-based models (RealNVP, Glow, etc.) Intractable: e.g. Markov Chain Monte Carlo, Variational Autoencoders series Implicit models Generative Adversarial Networks (GANs) and v..

    (작성중) [Generative Model] Generative Adversarial Networks(GAN)

    이 글은 GAN에 대한 필자의 이해를 높이고자 작성된 글입니다. 참고자료는 자료1 입니다. Concept of Generative Adversarial Networks(GAN) field of(Generative model-latent variable model), A neural net that maps noise vectors to observations Training: use the learning signal from a classifier trained to discriminate between samples from the model and the training data Pros Can generative very realistic images Conceptually simple imple..

    [Basic] Probabilistic model

    Data is treated as a random variable 🌰 Deterministic Neural Network Model weights are assumed to have a true value that is just unknown All weights are having a single fixed value as is the norm Often the absence of a statistical flavor to such an analysis is prone to overfitting on selected examples and in general, presents challenges to draw confident conclusions. Softmax Model can be uncertai..

    Uncertainty

    🐶 용어 정리 Prediction, Confidence, Probability 🐶Why uncertainty is important? Status Before: using the prediction Now: using prediction, uncertainty Purpose Uncertainty inherent in inductive inference Incorrect model assumptions noisy or imprecise data “... a weather forecaster can be very certain that the chance of rain is 50 %; or her best estimate at 20 % might be very uncertain due to lack of d..

    [Logger] TensorboardX 사용하기

    본 글은 필자의 이해를 돕기 위해 작성된 글로 TensorboardX를 Pytorch에서 구동하는데 일련의 과정을 적은 글입니다. TensorboardX: 모델의 파라미터나 accuracy, loss를 기록하는데 유용한 도구 Process Pytorch 모델에 기록한 파라미터 기록하기: 밑의 코드 출처와 같이 writer를 불러서 하는 경우도 있지만 구현된 모델들에서 사용할 때는 Callback으로 간단하게 파라미터를 추가만 해도 처리가 되도록 하는 경우가 대부분이다. x = torch.arange(-5, 5, 0.1).view(-1, 1) y = -5 * x + 0.1 * torch.randn(x.size()) model = torch.nn.Linear(1, 1) criterion = torch.nn...

    Training tip 정리

    Learning rate 부터 정리 Training 시간이 왜 이렇게 오래/짧게 걸리는가 Nvidia-smi (GPU 실시간 확인) Profiler (GPU 사용 history 정리) 어떤걸 고려해야 하는가 Multi-processing: Data loader 의 num_worker Multi-threading Training 되는지 어떻게 확인하는가 Loss이 내려가는지 확인. 특히, Loss 각 항목에 관해서 처리. Parameter나 buffer의 mean, variance 확인 Etc. 결과 확인시 전체 데이터에 대해서 해야지 나오는 batch에 따른 결과를 보면 안된다. Training 때 고려 GPU resource Dataset Training time Etc. Multi-processing..

    [Basic] Activation Function/Loss Function/Evaluation metric

    본 글은 필자의 이해를 돕기 위해 작성된 글입니다. 참고 링크: 링크1 🐤Loss Function 과 Evaluation Metric 차이점 간단히 말해서 Loss function은 딥러닝 모델 학습시 성능을 높이기 위해 minimize/maximize 시켜야 하는 지표이고, Evaluation metric은 여러 딥러닝 모델들 중에 좋은 성능을 확인하기 위해 쓰이는 지표입니다. 예를 들어 classification 문제라 하면 모델의 loss function은 대체적으로 crossentropyloss 으로 분류의 지표를 표시한다면 모델 들 간의 성능을 확인하기 위해서는 evaluation metric이 accuracy가 되어야 한다. 딥러닝 모델의 parameter estimation method 중 ..

    [NLP] 4. Modern Recurrent Neural Networks: Seq2Seq

    🐶 Encoder-Decoder structure 🐶 Sequence to Sequence

    [NLP] 3. Modern Recurrent Neural Networks: GRU, LSTM

    🎲 Gated Recurrent Units (GRU) 🎲 Long Short Term Memory (LSTM)

    [NLP] 2. RNN Basics: Language Model

    이 글은 필자가 Dive into Deep Learning을 읽고 정리한 글입니다. 🏉 Language Model Given a text sequence that consists of tokens$(x_1, x_2, \cdots, x_T)$ in a text sequence of length $T$, the goal of language model is to estimate the joint probability of the sequence $P(x_1, x_2, \cdots, x_T)$. We should know how to model a document or even a sequence of tokens. 🏉 Learning a language Model Let us start by applying..

    [NLP] 1. Introduction of NLP, Word2vec

    🏓 NLP: Natural Language Processing 자연어를 처리하는 분야, 우리의 말을 컴퓨터에게 이해시키기 위한 분야를 의미합니다. 자연어는 살아있는 언어이며 그 안에는 '부드러움'이 있습니다. 🏓 '단어의 의미'를 잘 파악하는 표현방법 시소러스(Thesaurus, 유의어 사전) 활용 단어 네트워크(사람의 손으로 만든 유의어 사전)를 이용하는 방법이다. 단어 사이의 '상위와 하위' 혹은 '전체와 부분' 등 더 세세한 관계까지 정의해둔다. ex. Car = auto, automobile, machine, motorcar 대표적인 시소러스는 WordNet(NLTK 모듈)이 존재한다. Cons: 사람이 수작업으로 레이블링하는 번거로움/시대 변화에 대응하기 어렵다./단어의 미묘한 차이를 표현할 수..

    [기초] CPU,GPU,TPU,NPU/CUDA/RAM 개념

    이 글은 CPU, GPU, CUDA, RAM에 관해 헷갈리는 부분들이 있어 필자가 이해한 내용을 정리한 글입니다. 참고자료는 링크, 블로그, 블로그, 링크 입니다. CPU(Computer Programming Unit, 중앙 처리 장치): 컴퓨터 및 운영 체제에 필요한 명령을 처리하는 중앙 장치. 여러 개의 프로세싱 코어를 갖추고 있다. 순차적인 프로그램을 실행할 때 좋은 성능을 발휘하지만 대용량 처리에는 약하다. NPU(Neural Processing Unit): 수년간 GPU를 이용해 딥러닝 연산을 해온 상황에서 딥러닝에 보다 최적화된 단위 계산 유형들을 HW 블럭을 꾸며서 최적화되고, 정형화되면서 아예 딥러닝 계산 전용 칩셋인 NPU가 생성되었다. Google의 TPU(Tensor Processin..

    [기초] 이미지 classification 기본 모델: VGG, GoogLeNet, ResNet

    이 글은 필자가 "밑바닥부터 시작하는 딥러닝 1"을 보고 헷갈리는 부분이나 다시 보면 좋을만한 부분들을 위주로 정리한 글입니다. 헷갈렸던 부분 CNN: (Conv - Relu) - Pooling 거침 Pooling layer는 크기만 줄어들뿐 깊게 만들기 위해서는 Conv layer가 필수적이다. 1x1 Conv vs. 3x3 Conv (1x1 Conv): 주로 채널 개수를 줄이기 위해 사용 (3x3 Conv, stride =1) 1. VGG 합성곱 계층과 풀링 계층으로 구성되는 기본적인 CNN Receptive field를 통한 (5x5) Conv보다 2개의 (3x3) Conv가 더 효율적임을 이야기 (Max pooling) - N개의 3x3 Convolution 을 거친후 FC Max pooling으..

    [기초] 딥러닝 성능 높이기: 층을 깊게 하는 것에 대하여

    정확도를 높일 수 있는 방법 데이터 확장Data augmentation 이미지 회전/세로 이동 등의 미세한 변화 이미지 일부를 잘라내는 crop나 좌우를 뒤집는 flip 밝기 등의 외형 변화나 확대 축소 등의 스케일 변화 층을 깊게 하기 '층을 깊게 하는 것'의 중요성 신경망의 매개변수가 줄어든다. 층을 깊게 한 신경망은 깊지 않은 경우보다 적은 매개변수로 같은 (혹은 그 이상) 수준의 표현력 달성 매개변수를 줄여 넓은 수용영역 소화: ex. 5x5 합성곱 연산 vs. 3x3 합성곱 연산을 2회 반복 학습해야 할 문제를 계층적으로 분해 각 층이 학습 해야 할 문제를 더 단순한 문제로 대체 정보를 계층적으로 전달 가능 '층을 깊게 하는 것'의 영향력 : single layer를 추가하는 것에 대한 파라미터..

    [Deep Learning] 헷갈리는 기본 용어 모음집 (1)

    본 글은 필자가 자꾸 헷갈려하는 용어들을 모아놓은 글입니다. 글의 순서가 매끄럽지 않을 수 있다는 점 참고해주세요. 헷갈리는 용어들을 생각날 때마다 업데이트 한 글입니다. CNN이란? : (Convolution + Subsampling) 의 연속 + (Fully-Connected) (Convolution + Subsampling) 을 통해 Feature Extraction을 수행한 후, (Fully-Connected)를 통해 분류를 실행하게 됩니다. 이런 일련의 구조를 통해 계층구조를 형성하는데, 이를 compositionality라 칭합니다. Convolution 과정을 통해 Image * filter를 통해 Convolved Feature를 뽑게 된다. tf.nn.conv2d(input, filter..

    (작성중) [기초] 3. Overfitting/Underfitting 및 Regularization일반화/일반화 기법

    이 글은 필자가 "밑바닥부터 시작하는 딥러닝 1"을 보고 헷갈리는 부분이나 다시 보면 좋을만한 부분들을 위주로 정리한 글입니다. 추가 참고: 링크1 🏈 Overfitting vs. Underfitting Overfitting과적합 Underfitting 🏈 모델의 Bias와 Variance https://gaussian37.github.io/machine-learning-concept-bias_and_variance/ Bias편향: 모델의 예측값과 실제값이 얼마나 떨어져있는가 Bias가 크면 underfitting Inductive bias General bias Variance분산: 예측 모델의 복잡도, variance가 크면 overfitting 🏈 Regularization 규제(Regulariza..