본문 바로가기
728x90

AI & Data/AI&ML Examples12

[Computer Vision Examples] Convert PyTorch: pt to onnx Convert PyTorch: pt to onnx 포스트 난이도: HOO_Senior # pt to onnx 아래는 onnx로 전환하는 예제코드이다. Colab이나 Notebook에서 작업할 수 있고 vscode에서도 notebook이 있으면 가능하다. 사용 조건에 맞춰서 조정해서 사용하면 된다. !pip install ultralytics onnx onnx-simplifier onnxruntime from ultralytics import YOLO model = YOLO("model_name.pt") model.export(format="onnx",imgsz=[640,640], opset=12) # export the model to ONNX format 2023. 11. 15.
[AI & ML Examples] Computer Vision Calibration: Normalized Points 예제코드 Computer Vision Calibration: Normalized Points 예제코드 포스트 난이도: HOO_Senior # Example Code 이번 포스트에서는 Computer vision에서 Normalized points에 대한 값을 구하기 위해서 Calibration이 어떻게 이루어지는지 살펴볼 수 있다. 아래의 예제코드를 보면 2 dimensional과 3 dimensional에 해당하는 포인트 값들이 homogeneous과정을 거치고 svd를 통해서 Normalized point에 대한 "M" 값이 구해지는 과정을 볼 수 있다. 여기서 꼭 svd function 말고도 lstsq () funciton을 사용해서도 Normalized 된 M을 산출해 낼 수 있다. 또한 산출된 resi.. 2023. 10. 13.
[AI/Computer Vision] 커스텀 데이터셋으로 사물 분석하기 #01 (Object Detection by Custom Dataset) 커스텀 데이터셋으로 사물 분석하기 (Object Detection by Custom Dataset) 포스트 난이도: HOO_Senior # 커스텀 데이터셋 (Custom Dataset) 이전 포스트에서 코코 데이터셋을 활용해서 간단한 Obejct detection을 해보았다. 코코 데이터셋은 욜로에서 제공하는 기본 데이터셋으로써 욜로를 학습하는 데에도 활용되었던 데이터셋에 해당된다. 예를 들자면 우리가 파이썬을 사용한다고 가정했을 때 별도의 모듈 설치 없이도 기본적으로 사용이 가능한 기능들이 있는 것처럼 욜로를 사용하는 데 있어서도 코코 데이터셋으로 학습된 라벨링의 경우에는 이미지 디텍팅이 바로 가능하다. 아래의 링크를 참고하면 해당 포스트를 살펴볼 수 있다. https://whoishoo.tistory.. 2023. 8. 8.
[AI / Computer Vison / Object Detection] COCO Dataset으로 간단한 Object Detection 해보기 COCO dataset으로 간단한 object detection 해보기 포스트 난이도: HOO_Middle # COCO Dataset COCO는 Common objects in context의 줄임말로 YOLO와 같이 computer vision의 효율성 향상을 위해서 만들어진 오픈형 데이터셋이다. 쉽게 생각해서 Google의 Open images dataset을 생각하면 된다. 우리가 사용하고 있는 computer vision 모델들은 Train과 Test, 학습과 테스트 과정을 위해서 특정한 데이터셋이 필요하다. 이러한 데이터셋을 기본값으로 사용하고 있는 것이 바로 코코 (COCO)인 셈이다. 따라서 YOLO에서는 특정한 이미지를 가지고 라벨링 학습 없이도 코코 데이터셋에서 제공된 라벨링의 경우에는 .. 2023. 7. 27.
[AI / Computer Vision] YOLOv8 맛보기 후기 YOLOv8 맛보기 후기 포스트 난이도: HOO_Senior # 단일 이미지 분석으로 YOLOv8과 이전 버전 비교 결국 도저히 참을 수 없어서 빠르게 급한 일부터 끝내놓고 YOLOv8 맛을 한번 봐 보았다. 이번 페이퍼 작업을 빠르게 끝낸 뒤에 여유 있을 때 사이드 프로젝트에 들어가기 전에 미리 맛을 보기 위해 YOLOv8을 colab 기반에서 살펴보았다. 일단 거두절미하고 글쓴이 프사에 있는 사진은 아마 v5인가 v6인가 가물가물하지만 암튼 YOLO 이전 버전인 건 확실하다. 왜냐하면 데이터 분석하는 과정에서 답답해서 놀던 시기였기에 프로젝트 이후에 해당하니 얼추 맞는 것 같다. %pip install ultralytics import ultralytics ultralytics.checks() 우선 .. 2023. 7. 27.
[SML] Marginal PDF Example codes Marginal PDF Example codes 포스트 난이도: HOO_Lead # Example codes # Library import numpy as np import pandas as pd from scipy.stats import norm, t import matplotlib.pyplot as plt #μX=μY= 0,σX=σY= 1 muX=0 muY=0 sigmaX=1 sigmaY=1 #interval [-3,3] xGrid=np.arange(-3,3,.01) yGrid=np.arange(-3,3,.01) #Normal X Pdf plt.figure() plt.plot(xGrid, norm.pdf(xGrid,muX,sigmaX)) plt.title("Marginal PDF(X)") plt.sh.. 2023. 2. 15.
[SML] Misclassification Rates Example Codes: guess, test data Misclassification Rates Example Codes: guess, test data 포스트 난이도: HOO_Lead # Example Codes # Library import numpy as np import pandas as pd from scipy.stats import norm, t import matplotlib.pyplot as plt def getClass1Prop(x,r): x=np.array(x) dist=np.zeros(len(x_train)) for i in range(len(x_train)): dist[i] = np.linalg.norm(x-x_train[i]) dist_label_1 = dist[y_train==1] dist_1r = dist_label_1[dist_.. 2023. 2. 15.
[AI/ML Examples] Factorization criterion in action in the special case of the bivariate normal pdf Factorization criterion in action in the special case of the bivariate normal pdf 포스트 난이도: HOO_Senior # Example 1 Find the marginals (i.e., the marginal pdfs of Xand Y from the joint pdf). If you are unable to do this analytically (which is fine, nopenalties), assume μX=μY= 0,σX=σY= 1, and ρ= 0.5; specifically, use numerical integration to find the values of the marginal pdfs on a fine grid from.. 2023. 2. 6.
[AI/ML Examples] MLE with data from exponential distribution MLE with data from exponential distribution 포스트 난이도: HOO_Senior # Example LetX1, . . . , X100be independent rvs from the exponential distribution with rateλ(i.e., rate is thereciprocal of the population mean here). Nature uses the following code to generate the data: set.seed(0); x = rexp(100,10); I.e., in the game theory setup, Nature chosesλ= 10, but this is not known to the Statistician. # Ex.. 2023. 2. 6.
[SML] Critical Thinkings of The Linear Regression Critical Thinkings of The Linear Regression 포스트 난이도: HOO_Senior # Linear regression에서 고려해야 하는 것들 Linear regression에서 얻은 결과를 분석하는데 있어서 기본적으로 고려해야 될 것들이 있다. 마치 기본적으로 산출된 결과를 분석하는데 알아두어야 될 지침서와 비슷하다. 아래의 예시를 활용하면 산출된 결과를 분석하는데 매우 용이하다. Is there a relationship between X1 and Y? How strong is the relationship between X2 and Y? Which X contribute to Y? How accurately can we predict future Y? is the re.. 2023. 1. 30.
[AI | Object Detection] YOLOv5 #01: Image Detecting YOLOv5 #01: Image Detecting 포스트 난이도: HOO_Senior [Notice] 포스트 난이도에 대한 설명 안녕하세요, HOOAI의 Henry입니다. Bro들의 질문에 대한 내용을 우선적으로 포스팅이 되다 보니 각각의 포스트에 대한 난이도가 달라서 난이도에 대한 부분을 작성하면 좋겠다는 의견을 들었습니다 whoishoo.tistory.com # yoloV5 yoloV5 라이브러리는 Machine learning 중에서 object detection에 특화된 라이브러리이다. 이미 이전 욜로 버전들도 object detection 분야에서 대중적으로 많이 사용되어 왔지만 이번 yoloV5를 통해 보다 더 업데이트된 라이브러리 사용이 가능해졌다. (물론 V5에 대한 시시비비가 있지만 필자.. 2022. 1. 19.
[Colaboratory] YOLO Object Detection Examples: 캐글 이미지 디텍팅 #01 YOLO Object Detection Examples: 캐글 이미지 디텍팅 #01 포스트 난이도: HOO_Senior [Notice] 포스트 난이도에 대한 설명 안녕하세요, HOOAI의 Henry입니다. Bro들의 질문에 대한 내용을 우선적으로 포스팅이 되다 보니 각각의 포스트에 대한 난이도가 달라서 난이도에 대한 부분을 작성하면 좋겠다는 의견을 들었습니다 whoishoo.tistory.com # Object Detection YOLO 라이브러리 기반으로 object detect 사용이 가능하다. 한마디로 image detecting이 가능하기에 YOLO 라이브러리를 많이 사용한다. 이번 예제에서는 Colab 기반으로 Kaggle의 dataset을 가져와 이미지 디텍팅을 하는 방법에 대해서 살펴보려고 .. 2022. 1. 5.
728x90