[CS231n]Image classification

2023. 5. 16. 11:01·AI-Study
728x90

1. Image Classfication

     API

    두 개의 함수를 사용함. Train과 Predictions

 

    First classifier: Nearest Neighbor (가장 심플한 classfier. 이 알고리즘은 약간 멍청함. )

    Training 단계에서는 모든 데이터를 암기한다. Predict 단계에서는 가장 비슷한 data를 찾아낸다.

       ex) 데이터 셋 예시: CIFAR10 

       ex) L1 distance; Manhattan distance (두 이미지를 비교하는 심플한 방법)

     

2.Python Code

 

import numpy as np

class NearestNeighbor:
    def __init__(self):
        pass
    def train(self, X, y):
    """ X is N x D where each row is an example. Y is 1-dimension of size N """
    # the nearest neighbor classifier smiply remembers all the training data
    self.Xtr = X
    self.ytr = y

    def predict(self, X):
    """ X is N x D where each row is an example we wish to predict label for"""
    num_test = X.shape[0]
    # lets make sure that the output type matches the input type
    Ypred = np.zeros(num_test, dtype = self.ytr.dtype)

    for i in xrange(num_test):
        #find the nearest trainging image to the i'th test image
        #using the L1 distance (sum of absolute value differences)
        distances = np.sum(np.abs(self.Xtr - X[i,:]), axis = 1)
        min_index = np.argmin(distances)
        Ypred[i] = self.ytr[min_index]

    return Ypred

 

Q. With N examples, how fast are training and prediction?

A:  Train O(1), Predict O(N)

더 큰 값의 K를 사용한다면, 

 

4. Distance Metrics

 

 L2는 L1과 반대로 좌표를 바꾸어도 값이 바뀌지 않는다. 

 L1 has coordinate dependency

http://vision.stanford.edu/teaching/cs231n-demos/knn/

 

http://vision.stanford.edu/teaching/cs231n-demos/knn/

 

vision.stanford.edu

지금까지 k값을 바꾸고 다른 거 metrics를 고르는 것에 대해 배움. 이러한 선택들을 hyperparameters라고함/

 

5. Hyperparameters

 어떤 k가 최적의 값일까? 어떤 distance가 최고일까? 이건 우리가 선택하는 값(hyperparameters)라 함

직접 해보고 대입하여 나중에 확인해보는 것임.

 problem-dependent

 

6. Splitting Data

 

7. Crossvalidation

 작은 데이터셋에 이용됨 딥러닝보단. training data를 여러 fold로 split하여 생각한다. 

 

8. KNearest Neighbor

9. Curse of dimensionality

10.Summary

11. Linear Classification

12. Deep Learning

13. Linear Classifier

 

728x90

'AI-Study' 카테고리의 다른 글

적합한 Activation function을 선택하는 법!  (0) 2023.07.10
임베디드 시스템에서 AI의 필요성  (0) 2023.05.21
[CS231n] Introduction to CNN for Visual Recognition  (0) 2023.05.15
[전력시장 예측] 수익성 계산  (0) 2022.02.07
Linear Regression  (0) 2021.08.09
'AI-Study' 카테고리의 다른 글
  • 적합한 Activation function을 선택하는 법!
  • 임베디드 시스템에서 AI의 필요성
  • [CS231n] Introduction to CNN for Visual Recognition
  • [전력시장 예측] 수익성 계산
뚱이, not a starfish
뚱이, not a starfish
M.S. Student,. Mainly interested in computer vision and autonomous cars
  • 뚱이, not a starfish
    Wilbur-Babo
    뚱이, not a starfish
  • 전체
    오늘
    어제
    • 분류 전체보기 (195)
      • Computer Graphics (0)
      • Algorithm (22)
        • BOJ (21)
        • 삼성 SW 역량 테스트 (0)
      • 통신 및 네트워크 (12)
      • Embedded Projects (2)
      • AI-Paper (10)
        • 3D-GS (1)
        • Mono-Depth (7)
        • Base (2)
      • AI-Study (16)
        • Computer Vision (1)
        • Tiny Object Detection (3)
      • Image Processing (3)
      • 자율주행자동차 (20)
        • [2023] 1-fifth AA EV (4)
        • [2022] 1-tenth AA EV (2)
        • ROS 1,2 (4)
        • 이론 (7)
        • 실습 (3)
      • 전기전자공학(전공) (12)
        • 반도체 (2)
        • 마이크로프로세서 (6)
      • EVS37 Ambassador (5)
      • .0 (9)
      • sw (16)
        • 정보보안 (1)
        • Android_develop (3)
      • 차량 제어 플랫폼 (5)
      • 영어 (3)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    자율주행시험
    현대자동차 자율주행
    헤네스
    자율주행작품
    현대차3월신입후기
    tar압축풀기
    심포지움
    현차떨
    현차 3월 신입 서류
    현대자동차 자율주행 서류 합격 후기
    현대자동차최종면접결과
    현대자동차최종불합
    자율주행자동차
    현차 3월 자율주행
    정렬
    software defined vehicle
    evs37 sdv
    헤네스유아용자동차
    tar 파일
    EVS37
    현차 자율주행
    오픽후기
    우분투터미널
    evs37sdv
    자율주행
    자율주행경진대회
    오블완챌린지
    rc카
    현대자동차 연구개발
    현대자동차 서류합격후기
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.0
뚱이, not a starfish
[CS231n]Image classification
상단으로

티스토리툴바