- for file in files do
- try
- use img = new Image<Bgr, byte>(file)
- Utils.log (sprintf "== File: %A" file)
- let cells = Utils.logTime "Whole analyze" (fun () -> ImageAnalysis.doAnalysis img (FileInfo(file).Name) config)
+ //try
+ let images = seq { for file in files -> Path.GetFileNameWithoutExtension(FileInfo(file).Name), new Image<Bgr, byte>(file) }
+
+ 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