self-attention|transformer
attentionX = \begin{bmatrix}x_{1} \\ x_{2} \\x_{3} \end{bmatrix}=\begin{bmatrix}a_{11}&a_{12}&a_{13}&a_{14} \\ a_{21}&a_{22}&a_{23}&a_{24} \\ a_{31}&a_{32}&a_{33}&a_{34} \end{bmatrix}=\begin{bmatrix}1&2&1&2 \\ 1&1&2&2 \\ 1&1&1&-1 \end{bmatrix}x_i = [a_{i1},a_{i2},a_{i3},a_{i4}]词向量: $x_1$(早),$x_3$(上),$x_3$(好)
attention = softmax(XX^T)XXX^T = \begin{bmatrix}a_{11}&a_{12}&a_{13}&a_{14} \\ a_{21}&a_{22}&a_{23}&a_{24} \\ a_{31}&a_{32}&a_{33}&a_{34} \end{bmatrix} \begin{bmatrix}a_{11}&a_{21}&a_{31} \
        
        
           2022-09-28  
        
        
          
          
            深度学习 
           
        
        
      
    opencv-note
1.创建纯色图片
cv::Mat mat(100, 100, CV_8UC3);
int es = mat.elemSize(); // 单个数据大小
int size = mat.rows * mat.cols * es; // 所有数据大小
for (int i = 0; i < size; i +=es){
    mat.data[i] = 0; // Blue
    mat.data[i + 1] = 0; // Green
    mat.data[i + 2] = 0; // Red
}
cv::imwrite("cv_blue.jpg",mat);
2.opencv颜色转换(RGB-HSV)opencv中HSV的取值范围:H:[0,180],S:[0,255],V:[0,255]
#include <iostream>
#include <opencv2/opencv.hpp>
int main() {
    //std::cout << cv::getVersionString() <<
        
        
           2021-05-13  
        
        
          
          
            opencv3 
           
        
        
          
          
            opencv samples 
          
        
      
    设计模式-Java
单例模式
饿汉式
#1
class Singleton{
    private final static Singleton instance = new Singleton();
    public static Singleton getInstance(){
        return instance;
    }
}
#2
public class Singleton{
    private static Singleton instance;
    static {
        instance = new Singleton();
    }
    public static Singleton getInstance(){
        return instance;
    }
}
懒汉式
#1 线程不安全
public class Singleton{
    private static Singleton instance;
    public static Singleton getInstance(){
        if(i
        
        
           2020-04-20  
        
        
          
          
            笔记