Detection, inspection and quality optimisation