Posts

Showing posts with the label AI

Yingshaoxo's thinking about machine learning

Machine Learning is all about try_and_cache. (Try action, get whether that action is good or bad to reach a goal) First, it has some basic input data and actions. It trys to memory the base input data to action pairs. Then if single data element is not enough to overcome the difficultys, it will try to memory the input data sequence to action pairs. The input sequence or list length will be bigger and bigger until it overcome the difficultys. The interesting part about human thinking is that sometimes they'll do abstriction to use short_id to replace long input sequence, so that they don't have to remember a lot of long sequence but a few special examples. And sometimes it will meet unknow long sequence input data, in this case, it will try to use random small length sequence data to perform actions. If somehow it uses random sub_sequence data win a success, it will remember those sub_sequence data as a long sequence data. But if his/her memory is about to run out, he/she will ...

How to do the image detection with opencv?

double Detector::getColorDiff( const cv::Mat& current_image, const cv::Mat& target_image) { auto current_image_color_means = mean(current_image); auto target_image_color_means = mean(target_image); double diff = 0 ; for ( int i = 0 ; i < 3 ; i++) { diff += abs (current_image_color_means.val[i] - target_image_color_means.val[i]); } return (diff * 100 ) / ( 255 * 3 ); } If 0 <= diff <= 20, we’ll consider it matchs. the smaller the similar.  ​

Sentence Rewrite (Text Formalization) by using machine learning

Method 1  Use ‘Sentence correction’ model to get a correct sentence. https://huggingface.co/shibing624/mengzi-t5-base-chinese-correction Use ‘Punctuation correction’ model to get a more correct sentence. https://huggingface.co/raynardj/classical-chinese-punctuation-guwen-biaodian If you have an advanced AI bot, you may directly ask him/she “Do you know how to speak ‘xxx’ in a another better way?” Method 2 Use ‘Punctuation and grammar correction’ model to get a more correct sentence. https://huggingface.co/oliverguhr/spelling-correction-english-base Use ‘BART Paraphrase’ model to get a simpler sentence. https://huggingface.co/eugenesiow/bart-paraphrase [Optional] Use ‘sentence style transfering’ or ‘text rewrite’ or ‘Text Formalizing’ model to rewrite the sentence. https://huggingface.co/tuner007/pegasus_paraphrase Method 3 Use ‘Offline Google translation’ model to translate that sentence to English language. Use ‘Punctuation and grammar correction’ m...

How to install Nvidia Driver and Tensorflow/Pytorch GPU version in Ubuntu/PopOS 22.04 at HP Zbook Studio G8 laptop

1. Upgrade HP bios  You could directly use online bios update to update your bios fireware. Reboot -> F2 -> Esc -> Set up WiFi -> reboot -> F10 -> update bios in a online way Or you could use Windows system to do the update: https://support.hp.com/us-en/document/ish_3894564-1633733-16 2. Switch to integrated graphics only mode In popos, you can do it in right-top-corner icon, power settings. In ubuntu, you can do it in nvidia-settings -> profile-settings -> use integrated graphics reboot 3. Use gcc-12 which gcc # if gcc is not gcc-12, then do the following sudo rm /usr/bin/gcc sudo ln -s /usr/bin/gcc-12 /usr/bin/gcc 4. Install nvidia special driver for your special gpu version For me, it’s GeForce RTX 3070 Mobile . From the nvidia driver download page, you could download a file like NVIDIA-Linux-x86_64-525.105.17.run https://www.nvidia.com/download/index.aspx?lang=en-us Then you do the following: sudo chmod 777 NVIDIA-Linux-x86_64- 525.105 . 17 ...

How to install tensorflow/pytorch gpu version in ubuntu 20.04 at hp zbook studio g8 laptop

1. Install a special ubuntu system starting from HP website  https://support.hp.com/hk-en/drivers/selfservice/hp-zbook-studio-15.6-inch-g8-mobile-workstation-pc/2100677682 Choose ubuntu, download the iso file, put it into a usb by using Balena Etcher , flush it into your laptop 2. After you get into the ubuntu20.04 system  You could use nvidia-smi to check the GPU memory. 3. Install tensorflow by using anaconda Tensorflow has a tutorial in here: https://www.tensorflow.org/install/pip It’s something like this: conda install -c conda-forge cudatoolkit= 11.8 . 0 python3 -m pip install nvidia-cudnn-cu11== 8.6 . 0.163 tensorflow== 2.12 .* mkdir -p $CONDA_PREFIX /etc/conda/activate.d echo 'CUDNN_PATH=$(dirname $(python -c "import nvidia.cudnn;print(nvidia.cudnn.__file__)"))' >> $CONDA_PREFIX /etc/conda/activate.d/env_vars.sh echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib/:$CUDNN_PATH/lib' >> $CONDA_PREFIX /etc/conda/act...