neural_network
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| neural_network [2024/02/16 09:39] – [Python Packages for AI] jhagstrand | neural_network [2024/08/27 10:43] (current) – [Orientation] jhagstrand | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Neural Network ====== | ====== Neural Network ====== | ||
| + | |||
| + | [[Gradient Descent]] \\ | ||
| + | [[Linear Algebra]] | ||
| === Neural Network NN === | === Neural Network NN === | ||
| Line 22: | Line 25: | ||
| https:// | https:// | ||
| + | Multilayer Perceptron | ||
| + | Fully Connected Neural Network == Neural Network | ||
| + | |||
| + | Is there a " | ||
| + | |||
| + | Neural Network == Multilayer Perceptron | ||
| + | |||
| + | weighted sum of inputs and weights | ||
| + | \begin{align*}z^{(i)} = w_{1}x_{1}^{(i)} + w_{2}x_{2}^{(i)} + .. .+ w_{k}x_{k}^{(i)} + b, | ||
| + | |||
| ==== 2 layer nn ==== | ==== 2 layer nn ==== | ||
| Build a neural network from scratch using python and numpy | Build a neural network from scratch using python and numpy | ||
| Line 35: | Line 48: | ||
| ==== Convolutional Neural Network CNN ==== | ==== Convolutional Neural Network CNN ==== | ||
| + | |||
| + | === How it Works === | ||
| + | https:// | ||
| + | |||
| + | |||
| + | IK means multiply I times K | ||
| + | |||
| + | I * K means convolve K over I | ||
| + | |||
| + | I is the input matrix | ||
| + | |||
| + | K is the kernel or filter | ||
| + | |||
| + | result of the convolution layer is the convolved feature map | ||
| + | |||
| + | result of the pooling layer is the pooled feature map | ||
| + | |||
| + | |||
| + | Unlike an artificial neuron in a fully-connected layer, a neuron in a convolutional layer is not connected to the entire input but just some section of the input data. These input neurons provide abstractions of small sections of the input data that, when combined over the entire input, we refer to as a feature map. | ||
| + | |||
| + | == feature extraction == | ||
| + | |||
| + | Basically, the artificial neurons in CNN are arranged into 2D or 3D grids which we call filters. Usually, each filter extracts the different types of features from the input data. For example, from the image, one filter can extract edges, lines, circles, or more complex shapes. | ||
| + | |||
| + | == convolutional function == | ||
| + | |||
| + | The process of extracting features uses a convolution function, and from that comes the name convolutional neural network. The figure below shows the matrix I to apply the convolution using filter K. This means that filter K passes through matrix I, and an element-by-element multiplication is applied between the corresponding element of the matrix I and filter K. Then, we sum the results of this multiplication into a number: | ||
| + | |||
| + | |||
| + | === Variations === | ||
| three primary object detectors you’ll encounter: | three primary object detectors you’ll encounter: | ||
| - | R-CNN and their variants, including the original R-CNN, Fast R- CNN, and Faster R-CNN | + | * R-CNN and their variants, including the original R-CNN, Fast R- CNN, and Faster R-CNN |
| - | Single Shot Detector (SSDs) | + | |
| - | YOLO | + | |
| R-CNNs are one of the first deep learning-based object detectors and are an | R-CNNs are one of the first deep learning-based object detectors and are an | ||
| Line 79: | Line 122: | ||
| ==== You Only Look Once YOLO ==== | ==== You Only Look Once YOLO ==== | ||
| + | |||
| + | YOLOv1 2015 Joseph Ched Redmon et al \\ | ||
| + | YOLOv2 2016 Redmon and Farhadi, aka YOLO9000 \\ | ||
| + | YOLOv3 2018 Redmon last version for Redmon, he bails out due to concerns about military applications \\ | ||
| + | YOLOv4 2020 Alexey Bochkovskiy et al: YOLOv4: Optimal Speed and Accuracy of Object Detection \\ | ||
| + | YOLOv5 Ultralytics, | ||
| + | YOLOv6 Alexey Bochkovskiy et al \\ | ||
| + | YOLOv7 Alexey Bochkovskiy et al \\ | ||
| + | YOLOv8 Ultralytics \\ | ||
| + | YOLOv9 ? \\ | ||
| + | |||
| + | https:// | ||
| + | |||
| + | |||
| Invented by Joseph Chet Redmon | Invented by Joseph Chet Redmon | ||
| Line 151: | Line 208: | ||
| When using these packages simultaneously, | When using these packages simultaneously, | ||
| - | - array dimensions reversed between numpy and cv2 | + | - array dimensions reversed between numpy and opencv |
| - | - openCV: | + | - openCV: |
| - | - numpy : math-based | + | - numpy : (y,x), (height, width), |
| ===== AI terminology ===== | ===== AI terminology ===== | ||
| Line 298: | Line 355: | ||
| Kalman Filter IoU KFIoU | Kalman Filter IoU KFIoU | ||
| + | |||
| + | pixel density - ppi, ppcm | ||
| + | |||
| + | pixel intensity - grayscale 0 to 255, 255 is intense, 0 is not | ||
| + | |||
| + | segmentation - Divide image into segments along object contours, so that each pixel is assigned to one segment. | ||
| + | |||
| + | semantic segmentation - color identifies object class. | ||
| + | |||
| + | instance segmentation - color identifies each individual object. | ||
| + | |||
| + | panoptic segmentation - semantic and instance segmentation combined. | ||
| + | |||
| + | object detection | ||
| + | |||
| + | object classification - Identify the class of an object. | ||
| + | |||
| + | object localization - The bounding box identifies the location of an object within an image. | ||
| + | |||
| + | object recognition - match the object to similar instances in a database of images. | ||
| + | |||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | https:// | ||
| + | |||
| + | Note. The contour comes first. | ||
| + | |||
| + | |||
| + | framework | ||
| + | |||
| + | model | ||
| + | |||
| + | configuration | ||
| + | |||
| + | backend | ||
| + | |||
| + | blob | ||
| + | |||
| + | outputs | ||
| Line 409: | Line 507: | ||
| aerial photo object orientation | aerial photo object orientation | ||
| + | |||
| + | ===== LLM ===== | ||
| + | |||
| + | ==== NLP ==== | ||
| + | |||
| + | ==== AI Code Writing ==== | ||
| + | |||
| + | As of August 2024 | ||
| + | AI models and tools for code writing | ||
| + | from Grok | ||
| + | |||
| + | OpenAI: ChatGPT | ||
| + | |||
| + | VS Code, GitHub, Copilot: All from the Microsoft world. | ||
| + | |||
| + | nlp | ||
| + | llm | ||
| + | transformer | ||
| + | |||
| + | capabilities: | ||
| + | * code suggestions | ||
| + | * autocompletion | ||
| + | * generate a function from a prompt | ||
| + | |||
| + | stand-alone operation vs integrated with IDE | ||
| + | |||
| + | LLM coding assistant | ||
| + | |||
| + | * the model | ||
| + | * the corpora | ||
| + | * source code | ||
| + | * multiple languages | ||
| + | * organized into categories and contexts | ||
| + | * the trained model | ||
| + | * the interface: | ||
| + | * chatbot | ||
| + | * virtual assistant | ||
| + | * code completion plugin for an IDE | ||
| + | |||
| + | ^ Company | ||
| + | | OpenAI | ||
| + | | OpenAI | ||
| + | | GitHub | ||
| + | | xAI | Grok | ||
| + | | Amazon | ||
| + | | Tabnine | ||
| + | |||
| + | ?:Tabnine | ||
| + | AI-based code completion with support for over 30 programming languages. | ||
| + | It's known for its ability to run locally or in the cloud, providing flexibility in deployment. | ||
| + | Tabnine also emphasizes privacy by allowing developers to host their own models. | ||
| + | |||
| + | Meta:Code Llama | ||
| + | free for both research and commercial use. | ||
| + | Code Llama has been highlighted for its performance in coding tasks, | ||
| + | even outperforming some versions of models like GPT-3.5 in certain benchmarks. | ||
| + | |||
| + | ?: | ||
| + | Mentioned for its impressive performance in coding tasks, | ||
| + | this model has been recognized for producing 100% compilable Java code in some evaluations, | ||
| + | indicating high-quality code generation capabilities. | ||
| + | |||
| + | Anthropic: Claude | ||
| + | While primarily known for its conversational abilities, | ||
| + | Claude' | ||
| + | especially in understanding and generating code for less common libraries or languages. | ||
| + | |||
| + | - **Local and Open-Source Models**: | ||
| + | There' | ||
| + | or even customized versions of these models for coding tasks. | ||
| + | Tools like `ollama.nvim` for Neovim or platforms allowing you to run these models | ||
| + | locally or on personal servers are becoming popular for those who prefer not to rely on | ||
| + | cloud-based solutions. | ||
| + | |||
| + | xAI: Grok | ||
| + | Although primarily known for its conversational abilities and integration with X (formerly Twitter), | ||
| + | Grok's capabilities in understanding and potentially generating code could be inferred from its | ||
| + | general language processing skills, though specific coding features might be less documented. | ||
| + | |||
| + | Each of these models or tools brings unique strengths to the table, | ||
| + | from integration capabilities with existing workflows, | ||
| + | support for a wide array of programming languages, | ||
| + | to performance in generating high-quality, | ||
| + | The choice between them might depend on factors like integration with | ||
| + | your current development environment, | ||
| + | Remember, while these tools can significantly enhance productivity, | ||
| + | they should be used as aids, with human oversight for critical or complex coding tasks. | ||
neural_network.1708094368.txt.gz · Last modified: 2024/02/16 09:39 by jhagstrand