A method for detecting defects in a weld of a container obtained by heat-sealing between two polymeric materials (1, 2), comprising the following steps: a) obtaining a thermographic image of the weld, in an instant t 1, wherein t 0 <t 1 <t max,, where t 0 is the time instant in which the weld has been completed, t max is the time instant in which the weld acquires room temperature (T amb) after cooling down from a welding temperature (T sold), wherein T sold >T amb, and t 1 is the instant in which the thermographic image is taken, b) rescaling the thermographic image to increase the contrast between the zone corresponding to the weld and the rest of the container by correcting the value of each pixel based on the minimum and maximum temperature value of the image, obtaining as a result a reference image, c) identifying in the reference image a weld area, binarizing the reference image and applying the binarized reference image by way of a mask on the thermographic image for identifying said weld area in the thermographic image, d) extracting at least one descriptor from the part of the thermographic image corresponding to the weld area, a descriptor being a measurable physical parameter, representative of the quality of the weld, and e) determining if the at least one extracted descriptor is within a validation interval defined by at least one threshold value, wherein the method additionally comprises one of the following options: i) correcting the thermographic image, before step d), at least the weld area, according to a value of the cooling of the polymeric materials (1, 2) taking into account the time elapsed between weld completion (t 0) and thermographic image capture (t 1), or ii) correcting, between steps d) and e), the value of the at least one extracted descriptor, according to the value of the cooling of the polymeric materials (1, 2) taking into account the time elapsed between weld completion (t 0) and thermographic image capture (t 1), obtaining a corrected descriptor value, or iii) correcting, before step e), the validation interval by correcting the at least one threshold value according to the cooling of the polymeric materials (1, 2) taking into account the time elapsed between weld completion (t 0) and thermographic image capture (t 1), wherein said value of the cooling of the polymeric materials (1, 2) is taken from a characteristic function (f) representing the cooling of the weld formed by these polymeric materials (1, 2) with respect to time. a) obtaining a thermographic image of the weld, in an instant t 1, wherein t 0 <t 1 <t max,, where t 0 is the time instant in which the weld has been completed, t max is the time instant in which the weld acquires room temperature (T amb) after cooling down from a welding temperature (T sold), wherein T sold >T amb, and t 1 is the instant in which the thermographic image is taken, b) rescaling the thermographic image to increase the contrast between the zone corresponding to the weld and the rest of the container by correcting the value of each pixel based on the minimum and maximum temperature value of the image, obtaining as a result a reference image, c) identifying in the reference image a weld area, binarizing the reference image and applying the binarized reference image by way of a mask on the thermographic image for identifying said weld area in the thermographic image, d) extracting at least one descriptor from the part of the thermographic image corresponding to the weld area, a descriptor being a measurable physical parameter, representative of the quality of the weld, and e) determining if the at least one extracted descriptor is within a validation interval defined by at least one threshold value, i) correcting the thermographic image, before step d), at least the weld area, according to a value of the cooling of the polymeric materials (1, 2) taking into account the time elapsed between weld completion (t 0) and thermographic image capture (t 1), or ii) correcting, between steps d) and e), the value of the at least one extracted descriptor, according to the value of the cooling of the polymeric materials (1, 2) taking into account the time elapsed between weld completion (t 0) and thermographic image capture (t 1), obtaining a corrected descriptor value, or iii) correcting, before step e), the validation interval by correcting the at least one threshold value according to the cooling of the polymeric materials (1, 2) taking into account the time elapsed between weld completion (t 0) and thermographic image capture (t 1), wherein said value of the cooling of the polymeric materials (1, 2) is taken from a characteristic function (f) representing the cooling of the weld formed by these polymeric materials (1, 2) with respect to time.