The invention provides a training-free text-
image generation method based on a
diffusion model, and relates to the technical field of computer graphic
processing and
artificial intelligence. The method comprises the following steps: extracting semantic phrases and
layout information in an input text by utilizing a
natural language model, inputting the input text, the semantic phrases and the
layout information as additional conditions into a
diffusion model, and extracting cross attention maps of different time steps; a positive and
negative sample concept and a foreground and background concept based on an object are constructed, a new
loss function is calculated on a cross attention map for
semantic information and
layout information, the
loss function combines semantic loss, regional loss and original loss of a
diffusion model and is used for updating a
potential space image, and the image is generated through iterative denoising and a decoder. According to the method, additional training is not needed,
image generation output based on the diffusion model better meets text requirements, and a better text and
image alignment effect is achieved.