Leak detection based on thermal imaging