A device for detecting metallic contaminants in a product using a signal received from a coil-based metal detector, the signal comprising a resistive component and a reactive component, wherein the device comprises: a detection module configured to compare, in a coordinate system for the resistive and reactive components, a vector representation (P1, P2) of the signal to a product-specific, bowtie-shaped detection envelope, and to indicate a presence of a metallic contaminant in the product when the vector representation of the signal extends to an area outside the bowtie-shaped detection envelope and the device further comprising a calibration module configured to determine the product-specific, bowtie-shaped detection envelope by receiving from the metal detector during a calibration phase signals for one or more specimens of the product, and determining a phase orientation (φ) and dimensions of the bowtie-shaped detection envelope using the signals, the bowtie-shaped detection envelope having two wings (W1, W2) which extend from a centre of the bowtie-shaped detection envelope in opposite directions along a longitudinal axis (z) to respective ends (E1, E2) of the bowtie-shaped detection envelope, the width (de, de') of the ends (E1, E2) of the bowtie-shaped detection envelope being greater than the width (dc) of the centre of the bowtie-shaped detection envelope, and the dimensions including at least one of: the width (dc) at the centre of the bowtie-shaped detection envelope, the width (de, de') at the ends (E1, E2) of the bowtie-shaped detection envelope, the length (L, 2L) of the bowtie-shaped detection envelope along its longitudinal axis (z), and an acute angle (γ) between the longitudinal axis (z) and an outer edge (t*) of the bowtie-shaped detection envelope, extending from the centre to the ends (E1, E2) of the bowtie-shaped detection envelope, wherein the calibration module is further configured to convert the resistive and reactive components (R, X) of the signals received from the metal detector during the calibration phase into polar coordinates, comprising a phase value and a magnitude value, to determine a product envelope by determining and storing during the calibration phase a peak magnitude value for each of the phase values, and to define the bowtie-shaped detection envelope using the product envelope characterized by the calibration module which is configured to determine the dimensions of the bowtie-shaped detection envelope by aligning the phase orientation (φ) with an axis of a coordinate system selected as the alignment axis, generating a quadrant overlay of the product envelope through reflection of the product envelope about the axes (R, X) of the coordinate system, determining measurements of the quadrant overlay, and determining the dimensions of the bowtie-shaped detection envelope using the measurements. a detection module configured to compare, in a coordinate system for the resistive and reactive components, a vector representation (P1, P2) of the signal to a product-specific, bowtie-shaped detection envelope, and to indicate a presence of a metallic contaminant in the product when the vector representation of the signal extends to an area outside the bowtie-shaped detection envelope and the device further comprising a calibration module configured to determine the product-specific, bowtie-shaped detection envelope by receiving from the metal detector during a calibration phase signals for one or more specimens of the product, and determining a phase orientation (φ) and dimensions of the bowtie-shaped detection envelope using the signals, the bowtie-shaped detection envelope having two wings (W1, W2) which extend from a centre of the bowtie-shaped detection envelope in opposite directions along a longitudinal axis (z) to respective ends (E1, E2) of the bowtie-shaped detection envelope, the width (de, de') of the ends (E1, E2) of the bowtie-shaped detection envelope being greater than the width (dc) of the centre of the bowtie-shaped detection envelope, and the dimensions including at least one of: the width (dc) at the centre of the bowtie-shaped detection envelope, the width (de, de') at the ends (E1, E2) of the bowtie-shaped detection envelope, the length (L, 2L) of the bowtie-shaped detection envelope along its longitudinal axis (z), and an acute angle (γ) between the longitudinal axis (z) and an outer edge (t*) of the bowtie-shaped detection envelope, extending from the centre to the ends (E1, E2) of the bowtie-shaped detection envelope, wherein the calibration module is further configured to convert the resistive and reactive components (R, X) of the signals received from the metal detector during the calibration phase into polar coordinates, comprising a phase value and a magnitude value, to determine a product envelope by determining and storing during the calibration phase a peak magnitude value for each of the phase values, and to define the bowtie-shaped detection envelope using the product envelope characterized by the calibration module which is configured to determine the dimensions of the bowtie-shaped detection envelope by aligning the phase orientation (φ) with an axis of a coordinate system selected as the alignment axis, generating a quadrant overlay of the product envelope through reflection of the product envelope about the axes (R, X) of the coordinate system, determining measurements of the quadrant overlay, and determining the dimensions of the bowtie-shaped detection envelope using the measurements.