- for file in files do
- try
- let fileInfo = FileInfo(file)
- use img = new Image<Bgr, byte>(file)
- let cells = Utils.logTime "Whole analyze" (fun () -> ImageAnalysis.doAnalysis img fileInfo.Name config)
+ let nbConcurrentTaskLimit = 4
+ let n = Environment.ProcessorCount
+
+ Utils.logTime "Whole analyze" (fun () ->
+ let results =
+ images
+ |> PSeq.map (fun (id, img) -> id, ImageAnalysis.doAnalysis img id (config.Copy()))
+ |> PSeq.withDegreeOfParallelism (if n > nbConcurrentTaskLimit then nbConcurrentTaskLimit else n)
+
+ for id, cells in results do