<jupyter_start><jupyter_text>**Histogram of Oriented Gradients**<jupyter_code>%reload_ext autoreload
%autoreload 2
%matplotlib inline
import cv2
import numpy as np
im = cv2.imread('lenna.jpeg')
im = np.float32(im) / 255.0
 
# Calculate gradient 
gx = cv2.Sobel(im, cv2.CV_32F, 1, 0, ksize=1)
gy = cv2.Sobel(im, cv2.CV_32F, 0, 1, ksize=1)
mag, angle = cv2.cartToPolar(gx, gy, angleInDegrees=True)
# cv2.imshow('gx', gx)
# cv2.imshow('gy', gy)
# cv2.imshow('mag', mag)
cv2.waitKey(0)
cv2.destroyAllWindows()
np.random.seed(0)
np.random.randn(1, 5)
np.random.seed(1)
np.random.randn(1, 5)
import matplotlib.pyplot as plt  
from sklearn.datasets import make_moons  
plt.subplot(122)  
x1,y1=make_moons(200,noise=0.1)  
plt.title('make_moons function example')  
plt.scatter(x1[:,0],x1[:,1],marker='o',c=y1)  
import torch<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1641086186540732, 'fraction_numerical': 0.0602125147579693, 'mean_word_length': 5.894308943089431, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '5670', 'license': 'MIT', 'n_tokens_mistral': 408, 'n_tokens_neox': 385, 'n_words': 69, 'path': 'week2/HoG.ipynb', 'repo_name': 'Fabriceli/MachingLearning', 'size': '847'}