Retransmission method for semantic communication
Technical Field
The invention relates to the technical field of semantic communication, in particular to a retransmission method of semantic communication.
Background
According to shannon and wever proposed information elements, communications can be divided into three layers. The first layer is a transmission problem, which mainly researches how to accurately transmit the communication symbols, the second layer is a semantic problem, which mainly researches how to accurately transmit the semantics in the communication symbols, and the third layer is a utility problem, which mainly solves the problem how to effectively influence the behaviors of the received semantics according to the expected mode. Because of the time limitation, in seventy years since shannon established the information theory, a great number of scholars have made a great deal of attempts to approach shannon's limit, but these efforts have focused mainly on the first level of communication, i.e. how to accurately transmit communication symbols. In recent years, the development of related technologies such as artificial intelligence and natural language processing has provided possibilities for exploring the second level of semantic communication, and semantic communication will gradually become a research trend in the communication field.
In the communication process, when facing different complex signal-to-noise conditions, transmission errors are unavoidable, when encountering transmission errors, the error conditions encountered in the transmission process can be avoided by continuously retransmitting information, the characteristics of different coding modes can be utilized in the traditional communication, the HARQ mode is adopted, the information is retransmitted, and meanwhile, the information is combined with the information transmitted before, so that channel resources are saved, and meanwhile, the accuracy of transmission is improved. However, in terms of semantic communication, aiming at the problem of information retransmission, no good solution is provided, so a semantic communication retransmission method based on a transducer is provided, the strong computing capacity of a neural network is fully exerted, the information transmitted before is fully utilized after the information is retransmitted, and the two are combined, thereby improving the accuracy of retransmission.
Disclosure of Invention
The invention aims to provide a retransmission method of semantic communication, which overcomes the defects in the prior art.
In order to achieve the above purpose, the present invention provides the following technical solutions:
the application discloses a retransmission method of semantic communication, which comprises the following steps:
S1, training a retransmission mode, wherein the retransmission mode comprises a multi-decoder mode and a single-decoder mode;
s2, numbering all words possibly used in the transmission process of the two parties according to the shared knowledge of the two parties, and creating a dictionary;
S3, word embedding is carried out on the input sentences by utilizing an input sentence embedding module, and position vectors are added; word embedding is carried out on the target sentences by utilizing a target sentence word embedding module, and position vectors are added; obtaining a word vector with a position vector corresponding to an input sentence and a word vector with a position vector corresponding to a target sentence;
S4, semantic coding: word vectors with position vectors corresponding to input sentences pass through a semantic coding layer, semantic coding is completed through a Encoder layer of Transformrer, and semantic coding vectors are obtained;
s5, passing the semantic coding vector through a wireless channel;
S6, semantic decoding: semantic coding vectors passing through a wireless channel are subjected to semantic decoding through a decoding layer of a transducer, and decoded semantic text is output after probability logistic regression processing;
S7, the receiver performs retransmission judgment according to the received semantic text; if retransmission is needed, a retransmission instruction is sent to a sender, the sender selects a retransmission mode, and the semantic code vector in the step S4 is sent to a wireless channel again to obtain a retransmitted semantic code vector; if no retransmission is needed, ending the transmission;
S8, combining the retransmitted semantic code vector with the previously received semantic code vector, and aggregating through a dimension integration module to obtain an aggregated semantic code vector; carrying out semantic decoding on the aggregated semantic coding vectors through a decoding layer of a transducer, outputting decoded semantic text after probability logistic regression processing, and returning to the step S7;
preferably, the multi-decoder mode includes the following training process:
A11, training an encoder and a decoder which can normally transmit under each signal-to-noise ratio;
a12, fixing the encoder in the step A11, and newly creating a second decoder, wherein the input of the second decoder is twice as large as that of the decoder in the step S1, and a dimension integration module is arranged in the second decoder; the dimension integration module is composed of a full-connection layer;
A13, transmitting the coding results of the twice coder, splicing the two coding results after the two coding results pass through a wireless channel, sending the spliced results into a second decoder, integrating the two coding results by utilizing a dimension integration module in the second decoder, and performing corresponding decoding operation on the integrated information by the second decoder;
a14, newly creating an N decoder according to the step A12 and the step A13, wherein N is a natural number greater than 2, and the input of the N decoder is N times of the decoder in the step A11;
and A15, finishing training, and sequentially starting the decoders according to the serial numbers of the decoders according to the number of retransmission required in the transmission process.
Preferably, the single decoder mode includes the following training process:
B11, establishing an encoder and a decoder, wherein a dimension integration module is arranged in the decoder, testing performance of the decoder under different retransmission times according to a channel to be transmitted and a text for training, determining the allowed maximum retransmission times N according to the performance, and determining the input dimension of the dimension integration module in the decoder according to the maximum retransmission times N; the input dimension of the dimension integrating module is N+1 times of the output dimension of the encoder;
B12, randomly determining the number of times of retransmission required in the training process, wherein the number of times of retransmission is smaller than the maximum number of times of retransmission, splicing the retransmitted information with the original information, taking the information as an input dimension of a dimension integrating module, and carrying out zero padding operation on the rest empty dimension;
B13, repeating the step B12 to obtain a single decoder which can be used for multiple retransmission.
Preferably, the step S2 specifically includes the following steps:
S21, reading the whole text file for transmission;
s22, word segmentation is carried out on the whole text, the use times of each word in the text are counted, each word is numbered, and words with too low use times are removed;
s23, adding the beginning or ending characters into the whole dictionary;
s24, outputting a dictionary.
Preferably, the specific steps in the step S3 are as follows:
s31, creating an embedding layer, sending sentences to be transmitted into the embedding layer, and converting the sentences into word vectors with mapping dimensions;
s32, calculating and adding a position vector;
s33, adding the word vector and the position vector to obtain the word vector with the position information.
Preferably, the specific steps in the step S4 are as follows:
S41, defining three matrixes, and carrying out three-time linear change on word vectors with position vectors corresponding to input sentences according to the three matrixes to obtain query vectors, key vectors and value vectors;
S42, self-Attention calculation is carried out on the query vector, the key vector and the value vector, so that an Attention vector is obtained;
S43, carrying out residual connection, adding the attention vector and the word vector with the position vector corresponding to the input sentence, and carrying out layer normalization operation on the obtained result to obtain a residual vector;
s44, performing feedforward transmission operation on the obtained residual vector, and activating the residual vector by using an activation function ReLU through two layers of linear mapping to obtain a semantic coding vector.
Preferably, the specific steps in the step S6 are as follows:
s61, inputting word vectors with position vectors corresponding to the obtained target sentences in the S3 into a multi-head self-attention layer for decoding;
S62, inputting the coded information received through the wireless channel and the output information of the multi-head self-attention layer in the last step into the multi-head attention layer for decoding;
S63, after the target sentence passes through the multi-head self-attention layer and the multi-head attention layer, a semantic decoding vector is obtained through a feedforward transmission layer;
S64, carrying out probability logistic regression through a Softmax function, and outputting sentences.
The invention has the beneficial effects that:
1. compared with the method for directly retransmitting information when encountering errors, the method effectively utilizes the information transmitted before, and improves the accuracy of retransmission by integrating the retransmitted information with the information transmitted initially.
2. Two specific retransmission schemes are provided, wherein one scheme is a multi-decoder mode, decoders with different input dimensions are adopted, and during retransmission, decoders with larger input dimensions are adopted to integrate multiple times of transmission information so as to decode one information; the other scheme is a single decoder mode, a decoder with a large input dimension is directly adopted, when information is not retransmitted, an automatic zero filling mode is adopted for the rest empty dimension, and the memory use of a receiver is saved in both modes.
The features and advantages of the present invention will be described in detail by way of example with reference to the accompanying drawings.
Drawings
FIG. 1 is a schematic diagram of a framework of a retransmission method of semantic communications according to the present invention;
FIG. 2 is a schematic diagram of a multi-decoder mode according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a single decoder mode according to an embodiment of the present invention.
Detailed Description
The present invention will be further described in detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the detailed description and specific examples, while indicating the invention, are intended for purposes of illustration only and are not intended to limit the scope of the invention. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the present invention.
Referring to fig. 1, an embodiment of the present invention provides a retransmission method of semantic communications,
Step one: numbering all words possibly used in the transmission process of the two parties according to the shared knowledge of the two parties, and creating a dictionary;
The dictionary is created by the following steps:
step 1, reading in the whole text file for transmission;
step 2, word segmentation is carried out on the whole text, the use times of each word in the text are counted, each word is numbered, and words with too low use times are removed;
Step 3, adding characters with special meanings such as start or stop in the whole dictionary;
and step 4, outputting a dictionary.
Step two: word embedding is carried out on the input sentences by utilizing an input sentence embedding module, and position vectors are added; word embedding is carried out on the target sentences by utilizing a target sentence word embedding module, and position vectors are added; obtaining a word vector with a position vector corresponding to an input sentence and a word vector with a position vector corresponding to a target sentence;
word embedding and position coding, which comprises the following specific processes:
Step 1, creating an embedding layer Embedding, sending a statement to be transmitted into the embedding layer Embedding, and converting the statement into a word vector with the mapping dimension;
step 2, adding a position vector, wherein the formula is as follows:
Wherein pos refers to the position of a word in a sentence, the value range is [0, L), L is the length of the sentence, i refers to the dimension number of the subvector, the value range is [0, embedding_dimension/2), embedding _dimension is the embedded dimension, and d model refers to the value of the embedded dimension embedding _dimension of Embedding layers;
Step 3, after obtaining the word vector of each word and the corresponding position vector thereof, adding the word vector and the corresponding position vector to obtain the word vector X Embedding with the position information.
Step three, semantic coding, namely finishing semantic coding according to semantic information of sentences through Encoder layers of Transformrer after the transmitted sentences pass through the semantic coding layers; the specific process is as follows:
Step 1, defining three matrixes W Q,WK,WV, and carrying out three linear changes on the word vector X Embedding obtained in the previous step according to the three matrixes to obtain a query vector Q, a key vector K and a value vector V;
step 2, calculating Self-Attention of the three vectors;
resulting in vector X attention, where d k represents the dimension of the vector;
Step 3, carrying out residual connection, adding the X attention obtained in the previous step with the X Embedding obtained in the second step, and carrying out layer normalization operation on the obtained result to obtain a residual vector X 'attention, wherein X' attention=layernorm(X+Xattention);
step 4, performing feedforward transmission operation on the obtained residual vector X' attention, and obtaining the vector X by performing two-layer linear mapping and activating with an activating function ReLU hidden
Xhidden=Linear(ReLU(Linear(Xattention)));
Step four, sentences with the semantic codes completed are transmitted through a wireless channel;
Step five, semantic decoding: carrying out semantic decoding on statement texts with two denoising modes and a decoding layer of a general transducer, and outputting the statement texts with the decoded statement texts after probability logistic regression processing; the specific process is as follows:
step 1, inputting word embedded vectors of the target sentences obtained in the step two into a multi-head self-attention layer for decoding;
step 2, inputting the coding information received through the wireless channel and the output information of the multi-head self-attention layer in the previous step into the multi-head attention layer for decoding;
Step 3, after the target sentence passes through the multi-head self-attention layer and the multi-head attention layer, a semantic decoding vector is obtained through a feedforward transmission layer;
and 4, carrying out probability logistic regression through a Softmax function, and outputting sentences.
Step six, the receiving party judges whether the received sentence needs to be retransmitted, if so, retransmission information is sent to the sending party;
Step seven, the sender repeats the operation of the step four, and the sentences with the semantic codes completed in the step three are sent into the wireless channel again;
step eight, the receiver combines the retransmission information with the information received before, aggregates the information through a full connection layer, and then repeats the step five until the transmission is successful or the maximum retransmission times are reached;
Specific: step 1, repeating the operation of the step four, and sending the information which is subjected to semantic coding before into a channel again;
step 2, the receiver splices the retransmitted information with the information received before, and sends the information to a full-connection layer for aggregation of the information after the splicing is completed;
and step 3, sending the vector with the aggregated information obtained in the previous step into a decoder, and repeating the operation of the step five.
Referring to fig. 2, a multi-decoder scheme is used for retransmission, and the training process is as follows:
A11, training an encoder and a decoder which can normally transmit under each signal-to-noise ratio;
a12, fixing the encoder in the step A11, and newly creating a second decoder, wherein the input of the second decoder is twice as large as that of the decoder in the step S1, and a dimension integration module is arranged in the second decoder; the dimension integration module is composed of a full-connection layer;
A13, transmitting the coding results of the twice coder, splicing the two coding results after the two coding results pass through a wireless channel, sending the spliced results into a second decoder, integrating the two coding results by utilizing a dimension integration module in the second decoder, and performing corresponding decoding operation on the integrated information by the second decoder;
a14, newly creating an N decoder according to the step A12 and the step A13, wherein N is a natural number greater than 2, and the input of the N decoder is N times of the decoder in the step A11;
A15, training is completed, and in the transmission process, the decoders are started in sequence according to the serial numbers of the decoders according to the number of retransmission required;
Referring to fig. 3, a single decoder mode is adopted for retransmission, and the training process is as follows:
B11, establishing an encoder and a decoder, wherein a dimension integration module is arranged in the decoder, testing performance of the decoder under different retransmission times according to a channel to be transmitted and a text for training, determining the allowed maximum retransmission times N according to the performance, and determining the input dimension of the dimension integration module in the decoder according to the maximum retransmission times N; the input dimension of the dimension integrating module is N+1 times of the output dimension of the encoder;
B12, randomly determining the number of times of retransmission required in the training process, wherein the number of times of retransmission is smaller than the maximum number of times of retransmission, splicing the retransmitted information with the original information, taking the information as an input dimension of a dimension integrating module, and carrying out zero padding operation on the rest empty dimension;
B13, repeating the step B12 to obtain a single decoder which can be used for multiple retransmission.
The foregoing description of the preferred embodiments of the invention is not intended to be limiting, but rather is intended to cover all modifications, equivalents, or alternatives falling within the spirit and principles of the invention.