ChatGPT

https://www.tiziran.com/topics-and-projects/chatgpt 

MindMap of ChatGPT Prompt Engineering for Developers by deeplearning.ai

https://learn.deeplearning.ai/chatgpt-prompt-eng   

#ChatGPT #LLM #tiziran 


Download source : https://github.com/tiziran/tiziran/blob/main/ChatGPT%20Prompt%20Engineering%20for%20Developers.md 








# ChatGPT


* introduction 

* two model

* based llm

* predict next word, based on text training data

* instruction tuned llm

* tries to follow instructions

* fine-tune on instructions and good attempts at following those instructions

* RLHF: reinforcement learning with human feedback

* principles

* 1: write clear and specific instructions

* 2: give the model time to think

* guidelines

* two model

* based llm

* predict next word, based on text training data

* instruction tuned llm

* tries to follow instructions

* fine-tune on instructions and good attempts at following those instructions

* RLHF: reinforcement learning with human feedback

* principles

* 1: write clear and specific instructions

* Tactic 1: Use delimiters

* Triple quotes: “””

* Triple backticks: ``` ``` ```

* Triple dashes: - - -

* Angle brackets:  <>

* XML tags: <tag› ‹/tag›

* Tactic 2: ask for structured output HtML, JSON

* Tactic 3: check whether conditions are satisfied check assumptions required to do the task

* Tactic 4: few-shot prompting

* give successful examples of completing tasks, then ask model to perform the task

* 2: give the model time to think

* Tactic1: specify the steps to complete a task

step1:…

step2:…

stepN:…

* Tactic2: instruct the model to work out its own solution before rushing to a conclusion 

* model limitations

* hallucination

* reducing hallucinations: fist find relevant information, then answer question.

* iterative 

* idea; implementation(code/data)[prompt];experimental result; error analysis

* prompt guidelines

* be clear and specific

* analyze why result does not give desired output

* refine the idea and the prompt

* repeat

* iterative process

* try something

* analyze where the result does not give what you want 

* clarify instructions, give more time to think

* refine prompts with a batch of examples


* summarizing

* Identify the following items from the review text: 

- Sentiment (positive or negative)

- Is the reviewer expressing anger? (true or false)

- Item purchased by reviewer

- Company that made the item


* inferring

* Determine whether each item in the following list of topics is a topic in the text below, which is delimited with triple backticks.


* transforming

* proofread and correct this review. Make it more compelling. Ensure it follows APA style guide and targets an advanced reader. Output in markdown format.


* expanding 

* You are a customer service AI assistant.

* temperature

* a. temperature=0 ; for tasks that require reliability, predictability

* b. temperature=0.3 ; for tasks that require variety

* b. temperature=0.7 ; for tasks that require high variety


* chatbot

* messages

1. system

2. user

3. assistant

* conclusion

* Principles

- Write clear and specific instructions

- Give the model time to "think"

- Iterative prompt development

- Capabilities: Summarizing, Inferring, Transforming, Expanding

- build a chatbot

https://www.tiziran.com/topics-and-projects/chatgpt 

ChatGPT Prompts for Computer Vision/Image processing/pattern recognition. My thoughts on the response ChatGPT provided to my inquiries in the field of computer vision/image processing.

#ChatGPT #Computer_Vision #Image_processing

https://www.tiziran.com/topics-and-projects/chatgpt 

you can ask:


what are the key takeaways from " name of the book "

How do I become computer vision engineer? 





Question: 

What are the best libraries for computer vision?

ChatGPT: 

There are several popular libraries for computer vision, including:

It is worth noting that the choice of library depends on the specific task and the requirements of your project.

My thought : 

Great answer. I have been utilizing OpenCV for over 15 years and it is the premier library for computer vision. Other libraries may be useful, but they are not as comprehensive and practical as OpenCV.

Question: What types of images does OpenCV support?

ChatGPT: 

OpenCV supports a wide variety of image types, including:

It should be noted that OpenCV is a very powerful library and can handle many other image types as well.

My thought : 

Great answer. I have utilized various types of images in OpenCV and it supports a wide range of formats and types. However, I should mention that OpenCV loads color images as BGR.

Question: Why and how can we convert an image from Cartesian to polar coordinates using OpenCV?

ChatGPT: 

In image processing, it is sometimes useful to represent an image in polar coordinates instead of the typical Cartesian coordinates. This can be beneficial for certain types of image analysis and manipulation, such as image registration and image enhancement. In OpenCV, the process of converting an image from Cartesian to polar coordinates can be achieved using the cv2.linearPolar() function. This function takes in the image, the center point of the image, the magnitude of the polar transformation, and a flag indicating whether the output image should be inverted. The function then returns the transformed image in polar coordinates.

My thought : 

Great answer. 

Question: Why do we use meshgrid in OpenCV?

ChatGPT: 

Meshgrid is a utility function in OpenCV that is used to create a rectangular grid out of an array of x and y coordinates. This grid can then be used for various operations, such as transforming and warping images, or for creating masks for filtering or segmentation. Additionally, it can be used for creating the coordinates for a 2D array of pixels in an image, which is useful for various types of image processing tasks.

My thought : 

Okay, that's a good answer. In many projects, I use the meshgrid function and implement floating meshgrid map functions for use in image processing applications where I need to, for example, change the image's Cartesian to polar system.

Question: What are some ways to optimize and increase the speed of OpenCV C++ image processing?

ChatGPT: 

There are several ways to optimize and increase the speed of image processing using OpenCV C++:

It's worth noting that, optimizing image processing may require a combination of these approaches, and the best option will depend on the specific task and the requirements of the project.

My thought : 

Okay, that's a good answer. cv::setNumThreads(4); cv::parallel_for_ ; I also compiled OpenCV based on different hardware such as Raspberry pi 3, Raspberry pi 4, Intel® Neural Compute Stick 2, Intel® Distribution of OpenVINO™ Toolkit, NVIDIA Jetson Nano ( 2GB and 4GB ram)


Question: What are some ways to optimize and increase the speed of OpenCV C++ image processing?

ChatGPT: 

There are several ways to optimize and increase the speed of image processing using OpenCV C++:

It's worth noting that, optimizing image processing may require a combination of these approaches, and the best option will depend on the specific task and the requirements of the project.

My thought : 

Okay, that's a good answer. cv::setNumThreads(4); cv::parallel_for_

https://github.com/pirahansiah/cvtest 

CVTest library to compare images for similarity/Image comparison 

A) modified images: 

feature-based (SIFT)/Detectors of salient points/areas

Key-point Matching

Histogram method

Key-points + Decision Trees

Simple euclidean distance

(Normalised) Cross Correlation

OpenCV PSNR,SSIM,

B) file-hash based (md5, sha1, etc) for exact duplicates

C) perceptual hashing (phash) for rescaled images


Table of Contents

Chapter 1: Introduction to Computer Vision

Chapter 2: Image Processing Fundamentals

Chapter 3: Feature Detection and Extraction

Chapter 4: Object Recognition

Chapter 5: Motion Analysis and Tracking

Chapter 6: 3D Computer Vision

Chapter 7: Applications of Computer Vision

Chapter 8: Current Trends and Future Directions

Appendix: Resources for Further Study

Chapter 1: Introduction to Pattern Recognition

Chapter 2: Fundamentals of Pattern Recognition

Chapter 3: Supervised Learning

Chapter 4: Unsupervised Learning

Chapter 5: Hybrid Approaches

Chapter 6: Evaluation and Validation

Chapter 7: Applications of Pattern Recognition

Chapter 8: Future Directions and Challenges

Appendix A: Resources and Tools for Pattern Recognition

Appendix B: Glossary of Terms


Chapter 1: Introduction to Cloud Computing for Computer Vision

Chapter 2: Setting Up a Cloud Environment for Computer Vision

Chapter 3: Image Processing and Analysis in the Cloud

Chapter 4: Object Detection and Recognition in the Cloud

Chapter 5: Video Processing and Analysis in the Cloud

Chapter 6: Cloud-Based Deep Learning for Computer Vision

Chapter 7: Cloud-Based Augmented Reality and Virtual Reality

Chapter 8: Security and Privacy in Cloud-Based Computer Vision

Chapter 9: Conclusion


Introduction

Chapter 1: Understanding Cloud Services for Image Processing

Chapter 2: Setting Up a Cloud Environment for Image Processing

Chapter 3: Image Processing Workflows on the Cloud

Chapter 4: Use Cases for Cloud Image Processing

Chapter 5: Best Practices for Cloud Image Processing

Conclusion

References


Introduction

Chapter 1: Fundamentals of IoT and Image Processing

Chapter 2: IoT for Image Capture and Transmission

Chapter 3: Image Processing Algorithms for IoT

Chapter 4: IoT for Image Analysis and Processing

Chapter 5: IoT for Computer Vision and Augmented Reality

Chapter 6: IoT for Medical Image Processing

Conclusion

References

Appendix


Introduction

Chapter 1: Understanding the Basics of Computer Vision

Chapter 2: Implementing Computer Vision in IoT Devices

Chapter 3: Computer Vision for Object Detection and Recognition

Chapter 4: Computer Vision for Face Detection and Recognition

Chapter 5: Computer Vision for Image and Video Processing

Chapter 6: Computer Vision for Augmented Reality

Chapter 7: Future Trends and Developments in Computer Vision for IoT Devices

Conclusion

References

Index



Machine vision and machine learning with cloud for IoT devices is an exciting and rapidly growing field that combines the power of computer vision, deep learning, pattern recognition, image processing, and cloud computing to create intelligent and connected devices that can analyze and interpret visual data in real-time.

With the increasing use of IoT devices, there is a growing need for machine vision and machine learning to improve the performance and capabilities of these devices. By using deep learning algorithms, these devices can learn to recognize patterns and make predictions based on visual data. This can be used to improve the accuracy and speed of image and object detection, as well as other computer vision tasks.

One of the key advantages of using machine vision and machine learning with cloud for IoT devices is that it allows for the processing and analysis of large amounts of data in real-time. By using cloud computing, these devices can access powerful computing resources and store large amounts of data without the need for expensive hardware. This makes it possible to analyze and interpret visual data from multiple sources in real-time, which is essential for a wide range of IoT applications.

Overall, machine vision and machine learning with cloud for IoT devices is a powerful combination that can greatly improve the performance and capabilities of IoT devices and enable new and innovative applications in a variety of industries.



Write Paper, Patent, Article, Post, :

Best questions to write a paper: https://www.linkedin.com/posts/drasadnaveed_how-to-actually-use-chatgpt-for-academia-ugcPost-7028709603722887168-_wDP?utm_source=share&utm_medium=member_desktop 


ChatGPT, MacOS, Python


conda create --name chatgpt python=3.10

conda activate chatgpt

pip3 install torch torchvision

pip3 install transformers

code 

from transformers import AutoModelWithLMHead, AutoTokenizer

import torch

tokenizer = AutoTokenizer.from_pretrained("microsoft/DialoGPT-large" , padding_side="left")  

model = AutoModelWithLMHead.from_pretrained("microsoft/DialoGPT-large")

for step in range(5):    

    new_user_input_ids = tokenizer.encode(input(">> User:") + tokenizer.eos_token, return_tensors='pt')    

    bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step > 0 else new_user_input_ids    

    chat_history_ids = model.generate(bot_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id)    

    print("DialoGPT: {}".format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)))


code 

print("www.tiziran.com")

from transformers import GPT2LMHeadModel, GPT2Tokenizer

model_name_or_path = 'microsoft/DialoGPT-medium'

tokenizer = GPT2Tokenizer.from_pretrained(model_name_or_path)

model = GPT2LMHeadModel.from_pretrained(model_name_or_path, timeout=3000)

input_text = "Hi, how are you?"

input_ids = tokenizer.encode(input_text, return_tensors='pt')

response = model.generate(input_ids)

output_text = tokenizer.decode(response[0], skip_special_tokens=True)

print(output_text)