From 59a541464a2ce5dd142ef129fd1495d042801d94 Mon Sep 17 00:00:00 2001 From: Viswamedha Nalabotu Date: Wed, 12 Nov 2025 12:59:37 +0000 Subject: [PATCH] Testing external model code --- notebooks/external-model-testing.ipynb | 148 +++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 notebooks/external-model-testing.ipynb diff --git a/notebooks/external-model-testing.ipynb b/notebooks/external-model-testing.ipynb new file mode 100644 index 0000000..05315ef --- /dev/null +++ b/notebooks/external-model-testing.ipynb @@ -0,0 +1,148 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "0910db83", + "metadata": {}, + "source": [ + "# Model Testing with GPT4ALL running locally" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "id": "47cacfc9", + "metadata": {}, + "outputs": [], + "source": [ + "# Imports\n", + "import json\n", + "import requests" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "484cfebc", + "metadata": {}, + "outputs": [], + "source": [ + "# Variables for model response\n", + "API_URL = \"http://localhost:4891/v1/chat/completions\"\n", + "HEADERS = {\"Content-Type\": \"application/json\"}\n", + "MODEL = \"DeepSeek-R1-Distill-Qwen-7B\"\n", + "MAX_TOKENS = 2000\n", + "TEMPERATURE = 0.28" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "90b9b1f1", + "metadata": {}, + "outputs": [], + "source": [ + "content = \"Teach me computer vision\"\n", + "data = {\"model\": MODEL,\"messages\":[{\"role\":\"user\",\"content\": content}],\"max_tokens\": MAX_TOKENS,\"temperature\": TEMPERATURE}\n", + "response = requests.post(API_URL, json = data, headers=HEADERS)" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "88a77498", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'{\"choices\":[{\"finish_reason\":\"stop\",\"index\":0,\"logprobs\":null,\"message\":{\"content\":\"\\\\nAlright, the user asked me to teach them computer vision again. I remember they wanted a comprehensive guide before.\\\\n\\\\nI should start by defining what computer vision is and its applications so they understand the scope.\\\\n\\\\nNext, setting up their environment is crucial because it\\'s hands-on. I\\'ll mention installing Python libraries like OpenCV and NumPy since those are essential for getting started.\\\\n\\\\nThen, image processing basics will be helpful. They need to know how to read images in different formats and perform simple operations like resizing or converting color spaces.\\\\n\\\\nObject detection comes next. Detecting faces is a common first step because it\\'s straightforward with Haar cascades using OpenCV.\\\\n\\\\nI should also cover feature extraction since many applications rely on identifying specific elements within images, like edges for edge detection techniques.\\\\n\\\\nTraining their own models will add value as they progress—using datasets and frameworks to build custom solutions. Including steps from data collection to model evaluation is important here.\\\\n\\\\nDeep learning with CNNs is a must because it\\'s the modern approach in computer vision. Explaining how convolutional layers work can help them grasp more advanced concepts later.\\\\n\\\\nFinally, applications will show why this knowledge matters—face recognition, medical imaging, and autonomous vehicles are hot fields right now.\\\\n\\\\nI\\'ll wrap up by encouraging practice through projects to reinforce their learning.\\\\n\\\\n\\\\nComputer Vision is a field of artificial intelligence that enables computers to interpret and understand visual information from the world. It involves techniques for image analysis, object detection, segmentation, feature extraction, and more. Here\\'s a step-by-step guide to get started with computer vision:\\\\n\\\\n---\\\\n\\\\n### **Step 1: Set Up Your Environment**\\\\nBefore diving into coding, make sure you have Python installed on your machine (Python is widely used in the AI/ML community). You can also use an Integrated Development Environment (IDE) like PyCharm or VS Code for better code organization.\\\\n\\\\nInstall essential libraries:\\\\n```bash\\\\npip install numpy opencv-python tensorflow keras scikit-learn matplotlib\\\\n```\\\\n\\\\n---\\\\n\\\\n### **Step 2: Learn the Basics of Image Processing**\\\\nFamiliarize yourself with how images are represented and manipulated in Python. Key concepts include:\\\\n\\\\n#### a) Reading Images\\\\nUse OpenCV (Open Source Computer Vision Tools) to read image files:\\\\n```python\\\\nimport cv2\\\\n\\\\n# Read an image from file\\\\nimage = cv2.imread(\\'example.jpg\\')\\\\n\\\\nif image is not None:\\\\n print(\\\\\"Image loaded successfully!\\\\\")\\\\nelse:\\\\n print(\\\\\"Error loading image\\\\\")\\\\n```\\\\n\\\\n#### b) Image Display\\\\nDisplay images using OpenCV or matplotlib:\\\\n```python\\\\ncv2.imshow(\\'Window Name\\', image)\\\\ncv2.waitKey(0) # Wait for a key press (0 waits until an event occurs, like ESC)\\\\ncv2.destroyAllWindows() # Close all windows with associated resources released\\\\n\\\\n# Using matplotlib instead of OpenCV\\\\nimport matplotlib.pyplot as plt\\\\n\\\\nplt.imshow(image[:, :, ::-1]) # Convert BGR to RGB format\\\\nplt.title(\\'Image\\')\\\\nplt.axis(\\'off\\') # Turn off axis for better visualization\\\\nplt.show()\\\\n```\\\\n\\\\n#### c) Image Resizing and Cropping\\\\n```python\\\\n# Resize an image (interpolation method)\\\\nresized_image = cv2.resize(image, (500, 300))\\\\n\\\\n# Crop the image to a specific region of interest (ROI)\\\\ncropped_image = image[100:400, 200:600] # Assuming coordinates are valid\\\\n```\\\\n\\\\n#### d) Color Space Conversion\\\\nConvert images between color spaces like BGR to HSV:\\\\n```python\\\\n# Convert from BGR to HSV\\\\nhsv_image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)\\\\n```\\\\n\\\\n---\\\\n\\\\n### **Step 3: Object Detection**\\\\nObject detection involves identifying and locating objects within an image. Common techniques include:\\\\n\\\\n#### a) Haar Cascade (Classifiers for Objects)\\\\nA simple method using OpenCV\\'s `cv2.CascadeClassifier`:\\\\n```python\\\\n# Load face cascade classifier\\\\nface_cascade = cv2.CascadeClassifier(\\'haarcascades/haarcascade_frontalface_default.xml\\')\\\\n\\\\n# Detect faces in the image\\\\nfaces = face_cascade.detectMultiScale(image, scaleFactor=1.05, minNeighbors=4)\\\\n\\\\nfor (x, y, w, h) in faces:\\\\n cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)\\\\n```\\\\n\\\\n#### b) Sliding Window Technique\\\\nA more flexible approach to detect objects of any size.\\\\n\\\\n---\\\\n\\\\n### **Step 4: Feature Extraction**\\\\nExtract useful information from images for tasks like classification or segmentation. Common features include edges, corners, and shape descriptors:\\\\n\\\\n```python\\\\n# Detecting Edges using Canny Algorithm\\\\nedges = cv2.Canny(image, threshold1=50, threshold2=150)\\\\n```\\\\n\\\\n---\\\\n\\\\n### **Step 5: Train Your Own Model**\\\\nOnce you have a basic understanding of image processing, start training your own models for object detection or classification.\\\\n\\\\n#### a) Collect Training Data:\\\\nGather images with bounding boxes (for detectors) or class labels (for classifiers).\\\\n\\\\n#### b) Use Deep Learning Frameworks:\\\\n- **TensorFlow/Keras**: Build custom models using pre-trained architectures like YOLO, SSD, or Faster R-CNN.\\\\n```python\\\\nfrom tensorflow.keras import Sequential\\\\nfrom tensorflow.keras.layers import Conv2D\\\\n\\\\nmodel = Sequential([\\\\n Conv2D(32, (3, 3), activation=\\'relu\\', input_shape=(64, 64, 3)),\\\\n MaxPooling2D(pool_size=(2, 2)),\\\\n Flatten(),\\\\n Dense(128, activation=\\'relu\\'),\\\\n Dropout(0.5),\\\\n Dense(1, activation=\\'sigmoid\\')\\\\n])\\\\n```\\\\n\\\\n#### c) Fine-Tune Models:\\\\nUse datasets like COCO or Pascal VOC and fine-tune pre-trained models.\\\\n\\\\n---\\\\n\\\\n### **Step 6: Explore Advanced Topics**\\\\nOnce you\\'re comfortable with the basics, explore more advanced concepts:\\\\n\\\\n- **Convolutional Neural Networks (CNNs)** for image classification.\\\\n- **Recurrent Neural Networks (RNNs)**/**Long Short-Term Memory networks (LSTMs)** for video processing.\\\\n- **Generative Adversarial Networks (GANs)** for generating synthetic images.\\\\n\\\\n---\\\\n\\\\n### **Step 7: Practice with Projects**\\\\nApply your knowledge to real-world problems. Some ideas include:\\\\n1. Face recognition using OpenCV and deep learning frameworks.\\\\n2. Image classification on datasets like MNIST or CIFAR-10.\\\\n3. Object detection in autonomous vehicles (self-driving cars).\\\\n\\\\n---\\\\n\\\\n### **Step 8: Resources for Further Learning**\\\\n- **Books**:\\\\n - \\\\\"Deep Learning for Computer Vision\\\\\" by Adrian Rosebrock\\\\n - \\\\\"Learning OpenCV\\\\\" by Gary Bradski and AndrewROUNDY\\\\n- **Tutorials/Documentation**:\\\\n - OpenCV官网文档 (https://docs.opencv.org/master/)\\\\n - TensorFlow/Keras官网文档 (https://www.tensorflow.org)\\\\n - PyTorch官网文档 (https://pytorch.org)\\\\n- **Online Courses**:\\\\n - Udacity\\'s Deep Learning Nanodegree\\\\n - Coursera\\'s \\\\\"Introduction to Computer Vision\\\\\" by Georgia Tech\\\\n\\\\n---\\\\n\\\\n### Final Thoughts\\\\nComputer vision is a vast and exciting field. With practice, patience, and continuous learning, you\\'ll be able to build impressive applications that analyze and interpret visual data!\",\"role\":\"assistant\"},\"references\":null}],\"created\":1762952074,\"id\":\"placeholder\",\"model\":\"DeepSeek-R1-Distill-Qwen-7B\",\"object\":\"chat.completion\",\"usage\":{\"completion_tokens\":1537,\"prompt_tokens\":18,\"total_tokens\":1555}}'" + ] + }, + "execution_count": 39, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response.text" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "c416905c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "{'choices': [{'finish_reason': 'stop',\n", + " 'index': 0,\n", + " 'logprobs': None,\n", + " 'message': {'content': '\\nAlright, the user asked me to teach them computer vision again. I remember they wanted a comprehensive guide before.\\n\\nI should start by defining what computer vision is and its applications so they understand the scope.\\n\\nNext, setting up their environment is crucial because it\\'s hands-on. I\\'ll mention installing Python libraries like OpenCV and NumPy since those are essential for getting started.\\n\\nThen, image processing basics will be helpful. They need to know how to read images in different formats and perform simple operations like resizing or converting color spaces.\\n\\nObject detection comes next. Detecting faces is a common first step because it\\'s straightforward with Haar cascades using OpenCV.\\n\\nI should also cover feature extraction since many applications rely on identifying specific elements within images, like edges for edge detection techniques.\\n\\nTraining their own models will add value as they progress—using datasets and frameworks to build custom solutions. Including steps from data collection to model evaluation is important here.\\n\\nDeep learning with CNNs is a must because it\\'s the modern approach in computer vision. Explaining how convolutional layers work can help them grasp more advanced concepts later.\\n\\nFinally, applications will show why this knowledge matters—face recognition, medical imaging, and autonomous vehicles are hot fields right now.\\n\\nI\\'ll wrap up by encouraging practice through projects to reinforce their learning.\\n\\n\\nComputer Vision is a field of artificial intelligence that enables computers to interpret and understand visual information from the world. It involves techniques for image analysis, object detection, segmentation, feature extraction, and more. Here\\'s a step-by-step guide to get started with computer vision:\\n\\n---\\n\\n### **Step 1: Set Up Your Environment**\\nBefore diving into coding, make sure you have Python installed on your machine (Python is widely used in the AI/ML community). You can also use an Integrated Development Environment (IDE) like PyCharm or VS Code for better code organization.\\n\\nInstall essential libraries:\\n```bash\\npip install numpy opencv-python tensorflow keras scikit-learn matplotlib\\n```\\n\\n---\\n\\n### **Step 2: Learn the Basics of Image Processing**\\nFamiliarize yourself with how images are represented and manipulated in Python. Key concepts include:\\n\\n#### a) Reading Images\\nUse OpenCV (Open Source Computer Vision Tools) to read image files:\\n```python\\nimport cv2\\n\\n# Read an image from file\\nimage = cv2.imread(\\'example.jpg\\')\\n\\nif image is not None:\\n print(\"Image loaded successfully!\")\\nelse:\\n print(\"Error loading image\")\\n```\\n\\n#### b) Image Display\\nDisplay images using OpenCV or matplotlib:\\n```python\\ncv2.imshow(\\'Window Name\\', image)\\ncv2.waitKey(0) # Wait for a key press (0 waits until an event occurs, like ESC)\\ncv2.destroyAllWindows() # Close all windows with associated resources released\\n\\n# Using matplotlib instead of OpenCV\\nimport matplotlib.pyplot as plt\\n\\nplt.imshow(image[:, :, ::-1]) # Convert BGR to RGB format\\nplt.title(\\'Image\\')\\nplt.axis(\\'off\\') # Turn off axis for better visualization\\nplt.show()\\n```\\n\\n#### c) Image Resizing and Cropping\\n```python\\n# Resize an image (interpolation method)\\nresized_image = cv2.resize(image, (500, 300))\\n\\n# Crop the image to a specific region of interest (ROI)\\ncropped_image = image[100:400, 200:600] # Assuming coordinates are valid\\n```\\n\\n#### d) Color Space Conversion\\nConvert images between color spaces like BGR to HSV:\\n```python\\n# Convert from BGR to HSV\\nhsv_image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)\\n```\\n\\n---\\n\\n### **Step 3: Object Detection**\\nObject detection involves identifying and locating objects within an image. Common techniques include:\\n\\n#### a) Haar Cascade (Classifiers for Objects)\\nA simple method using OpenCV\\'s `cv2.CascadeClassifier`:\\n```python\\n# Load face cascade classifier\\nface_cascade = cv2.CascadeClassifier(\\'haarcascades/haarcascade_frontalface_default.xml\\')\\n\\n# Detect faces in the image\\nfaces = face_cascade.detectMultiScale(image, scaleFactor=1.05, minNeighbors=4)\\n\\nfor (x, y, w, h) in faces:\\n cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)\\n```\\n\\n#### b) Sliding Window Technique\\nA more flexible approach to detect objects of any size.\\n\\n---\\n\\n### **Step 4: Feature Extraction**\\nExtract useful information from images for tasks like classification or segmentation. Common features include edges, corners, and shape descriptors:\\n\\n```python\\n# Detecting Edges using Canny Algorithm\\nedges = cv2.Canny(image, threshold1=50, threshold2=150)\\n```\\n\\n---\\n\\n### **Step 5: Train Your Own Model**\\nOnce you have a basic understanding of image processing, start training your own models for object detection or classification.\\n\\n#### a) Collect Training Data:\\nGather images with bounding boxes (for detectors) or class labels (for classifiers).\\n\\n#### b) Use Deep Learning Frameworks:\\n- **TensorFlow/Keras**: Build custom models using pre-trained architectures like YOLO, SSD, or Faster R-CNN.\\n```python\\nfrom tensorflow.keras import Sequential\\nfrom tensorflow.keras.layers import Conv2D\\n\\nmodel = Sequential([\\n Conv2D(32, (3, 3), activation=\\'relu\\', input_shape=(64, 64, 3)),\\n MaxPooling2D(pool_size=(2, 2)),\\n Flatten(),\\n Dense(128, activation=\\'relu\\'),\\n Dropout(0.5),\\n Dense(1, activation=\\'sigmoid\\')\\n])\\n```\\n\\n#### c) Fine-Tune Models:\\nUse datasets like COCO or Pascal VOC and fine-tune pre-trained models.\\n\\n---\\n\\n### **Step 6: Explore Advanced Topics**\\nOnce you\\'re comfortable with the basics, explore more advanced concepts:\\n\\n- **Convolutional Neural Networks (CNNs)** for image classification.\\n- **Recurrent Neural Networks (RNNs)**/**Long Short-Term Memory networks (LSTMs)** for video processing.\\n- **Generative Adversarial Networks (GANs)** for generating synthetic images.\\n\\n---\\n\\n### **Step 7: Practice with Projects**\\nApply your knowledge to real-world problems. Some ideas include:\\n1. Face recognition using OpenCV and deep learning frameworks.\\n2. Image classification on datasets like MNIST or CIFAR-10.\\n3. Object detection in autonomous vehicles (self-driving cars).\\n\\n---\\n\\n### **Step 8: Resources for Further Learning**\\n- **Books**:\\n - \"Deep Learning for Computer Vision\" by Adrian Rosebrock\\n - \"Learning OpenCV\" by Gary Bradski and AndrewROUNDY\\n- **Tutorials/Documentation**:\\n - OpenCV官网文档 (https://docs.opencv.org/master/)\\n - TensorFlow/Keras官网文档 (https://www.tensorflow.org)\\n - PyTorch官网文档 (https://pytorch.org)\\n- **Online Courses**:\\n - Udacity\\'s Deep Learning Nanodegree\\n - Coursera\\'s \"Introduction to Computer Vision\" by Georgia Tech\\n\\n---\\n\\n### Final Thoughts\\nComputer vision is a vast and exciting field. With practice, patience, and continuous learning, you\\'ll be able to build impressive applications that analyze and interpret visual data!',\n", + " 'role': 'assistant'},\n", + " 'references': None}],\n", + " 'created': 1762952074,\n", + " 'id': 'placeholder',\n", + " 'model': 'DeepSeek-R1-Distill-Qwen-7B',\n", + " 'object': 'chat.completion',\n", + " 'usage': {'completion_tokens': 1537,\n", + " 'prompt_tokens': 18,\n", + " 'total_tokens': 1555}}" + ] + }, + "execution_count": 40, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response_data = json.loads(response.text)\n", + "response_data" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "2553d924", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'\\nAlright, the user asked me to teach them computer vision again. I remember they wanted a comprehensive guide before.\\n\\nI should start by defining what computer vision is and its applications so they understand the scope.\\n\\nNext, setting up their environment is crucial because it\\'s hands-on. I\\'ll mention installing Python libraries like OpenCV and NumPy since those are essential for getting started.\\n\\nThen, image processing basics will be helpful. They need to know how to read images in different formats and perform simple operations like resizing or converting color spaces.\\n\\nObject detection comes next. Detecting faces is a common first step because it\\'s straightforward with Haar cascades using OpenCV.\\n\\nI should also cover feature extraction since many applications rely on identifying specific elements within images, like edges for edge detection techniques.\\n\\nTraining their own models will add value as they progress—using datasets and frameworks to build custom solutions. Including steps from data collection to model evaluation is important here.\\n\\nDeep learning with CNNs is a must because it\\'s the modern approach in computer vision. Explaining how convolutional layers work can help them grasp more advanced concepts later.\\n\\nFinally, applications will show why this knowledge matters—face recognition, medical imaging, and autonomous vehicles are hot fields right now.\\n\\nI\\'ll wrap up by encouraging practice through projects to reinforce their learning.\\n\\n\\nComputer Vision is a field of artificial intelligence that enables computers to interpret and understand visual information from the world. It involves techniques for image analysis, object detection, segmentation, feature extraction, and more. Here\\'s a step-by-step guide to get started with computer vision:\\n\\n---\\n\\n### **Step 1: Set Up Your Environment**\\nBefore diving into coding, make sure you have Python installed on your machine (Python is widely used in the AI/ML community). You can also use an Integrated Development Environment (IDE) like PyCharm or VS Code for better code organization.\\n\\nInstall essential libraries:\\n```bash\\npip install numpy opencv-python tensorflow keras scikit-learn matplotlib\\n```\\n\\n---\\n\\n### **Step 2: Learn the Basics of Image Processing**\\nFamiliarize yourself with how images are represented and manipulated in Python. Key concepts include:\\n\\n#### a) Reading Images\\nUse OpenCV (Open Source Computer Vision Tools) to read image files:\\n```python\\nimport cv2\\n\\n# Read an image from file\\nimage = cv2.imread(\\'example.jpg\\')\\n\\nif image is not None:\\n print(\"Image loaded successfully!\")\\nelse:\\n print(\"Error loading image\")\\n```\\n\\n#### b) Image Display\\nDisplay images using OpenCV or matplotlib:\\n```python\\ncv2.imshow(\\'Window Name\\', image)\\ncv2.waitKey(0) # Wait for a key press (0 waits until an event occurs, like ESC)\\ncv2.destroyAllWindows() # Close all windows with associated resources released\\n\\n# Using matplotlib instead of OpenCV\\nimport matplotlib.pyplot as plt\\n\\nplt.imshow(image[:, :, ::-1]) # Convert BGR to RGB format\\nplt.title(\\'Image\\')\\nplt.axis(\\'off\\') # Turn off axis for better visualization\\nplt.show()\\n```\\n\\n#### c) Image Resizing and Cropping\\n```python\\n# Resize an image (interpolation method)\\nresized_image = cv2.resize(image, (500, 300))\\n\\n# Crop the image to a specific region of interest (ROI)\\ncropped_image = image[100:400, 200:600] # Assuming coordinates are valid\\n```\\n\\n#### d) Color Space Conversion\\nConvert images between color spaces like BGR to HSV:\\n```python\\n# Convert from BGR to HSV\\nhsv_image = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)\\n```\\n\\n---\\n\\n### **Step 3: Object Detection**\\nObject detection involves identifying and locating objects within an image. Common techniques include:\\n\\n#### a) Haar Cascade (Classifiers for Objects)\\nA simple method using OpenCV\\'s `cv2.CascadeClassifier`:\\n```python\\n# Load face cascade classifier\\nface_cascade = cv2.CascadeClassifier(\\'haarcascades/haarcascade_frontalface_default.xml\\')\\n\\n# Detect faces in the image\\nfaces = face_cascade.detectMultiScale(image, scaleFactor=1.05, minNeighbors=4)\\n\\nfor (x, y, w, h) in faces:\\n cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2)\\n```\\n\\n#### b) Sliding Window Technique\\nA more flexible approach to detect objects of any size.\\n\\n---\\n\\n### **Step 4: Feature Extraction**\\nExtract useful information from images for tasks like classification or segmentation. Common features include edges, corners, and shape descriptors:\\n\\n```python\\n# Detecting Edges using Canny Algorithm\\nedges = cv2.Canny(image, threshold1=50, threshold2=150)\\n```\\n\\n---\\n\\n### **Step 5: Train Your Own Model**\\nOnce you have a basic understanding of image processing, start training your own models for object detection or classification.\\n\\n#### a) Collect Training Data:\\nGather images with bounding boxes (for detectors) or class labels (for classifiers).\\n\\n#### b) Use Deep Learning Frameworks:\\n- **TensorFlow/Keras**: Build custom models using pre-trained architectures like YOLO, SSD, or Faster R-CNN.\\n```python\\nfrom tensorflow.keras import Sequential\\nfrom tensorflow.keras.layers import Conv2D\\n\\nmodel = Sequential([\\n Conv2D(32, (3, 3), activation=\\'relu\\', input_shape=(64, 64, 3)),\\n MaxPooling2D(pool_size=(2, 2)),\\n Flatten(),\\n Dense(128, activation=\\'relu\\'),\\n Dropout(0.5),\\n Dense(1, activation=\\'sigmoid\\')\\n])\\n```\\n\\n#### c) Fine-Tune Models:\\nUse datasets like COCO or Pascal VOC and fine-tune pre-trained models.\\n\\n---\\n\\n### **Step 6: Explore Advanced Topics**\\nOnce you\\'re comfortable with the basics, explore more advanced concepts:\\n\\n- **Convolutional Neural Networks (CNNs)** for image classification.\\n- **Recurrent Neural Networks (RNNs)**/**Long Short-Term Memory networks (LSTMs)** for video processing.\\n- **Generative Adversarial Networks (GANs)** for generating synthetic images.\\n\\n---\\n\\n### **Step 7: Practice with Projects**\\nApply your knowledge to real-world problems. Some ideas include:\\n1. Face recognition using OpenCV and deep learning frameworks.\\n2. Image classification on datasets like MNIST or CIFAR-10.\\n3. Object detection in autonomous vehicles (self-driving cars).\\n\\n---\\n\\n### **Step 8: Resources for Further Learning**\\n- **Books**:\\n - \"Deep Learning for Computer Vision\" by Adrian Rosebrock\\n - \"Learning OpenCV\" by Gary Bradski and AndrewROUNDY\\n- **Tutorials/Documentation**:\\n - OpenCV官网文档 (https://docs.opencv.org/master/)\\n - TensorFlow/Keras官网文档 (https://www.tensorflow.org)\\n - PyTorch官网文档 (https://pytorch.org)\\n- **Online Courses**:\\n - Udacity\\'s Deep Learning Nanodegree\\n - Coursera\\'s \"Introduction to Computer Vision\" by Georgia Tech\\n\\n---\\n\\n### Final Thoughts\\nComputer vision is a vast and exciting field. With practice, patience, and continuous learning, you\\'ll be able to build impressive applications that analyze and interpret visual data!'" + ] + }, + "execution_count": 41, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "response_data['choices'][0]['message']['content']" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": ".venv", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}