TIL about comparing floats in Swift
Fun with comparing floats again: Floating-point Swift, ulp, and epsilon, talk on the topic from iOS Conf SG 2017.
Based on what’s discussed in video above it’s interesting to refactor following two extensions with code duplication into one:
extension Array where Element == Double {
public init(txtFileURL: URL) throws {
self =
try String(contentsOf: txtFileURL)
.trimmingCharacters(in: .whitespacesAndNewlines)
.components(separatedBy: .whitespacesAndNewlines)
.map { Double($0)! } // force unwrap intentionally!
}
}
extension Array where Element == Float {
public init(txtFileURL: URL) throws {
self =
try String(contentsOf: txtFileURL)
.trimmingCharacters(in: .whitespacesAndNewlines)
.components(separatedBy: .whitespacesAndNewlines)
.map { Float($0)! } // force unwrap intentionally!
}
}
Browsed Swift proposal Approximate Equality for Floating Point because it’s connected to the topic.
Passed over Float by Example - Swift Programming Language and Double by Example - Swift Programming Language to check if I familiar with everything.
Interesting finding Create Object Detection and Segmentation Neural Networks without Code.
Here post by Alexey Korotkov, creator of MakeML.app MakeML’s Automated Video Annotation Tool for Object Detection on iOS. Has great hint for speeding app creation of dataset for object detection.
Crosslink the post above worth reading Object Detection Guide. Almost everything you need to know about how object detection works..
Learned about baseline for Xcode performance tests. Here’s explained where baselines are stored inside project.
Read about office access system in mail.ru office developed with OpenCV and Vision, their cloud computer vision service.