Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for i in 0..<size {
- for j in 0..<size {
- var scores: [Float] = []
- for k in 0..<depth {
- let index = i * size * depth + j * depth + k
- let score = array[index]
- scores.append(score)
- }
- if let maxScore = scores.max(),
- let maxClass = scores.firstIndex(of: maxScore) {
- let index = i * size + j
- if maxClass == 0 {
- pixelBuffer[index] = .blue
- } else if maxClass == 12 {
- pixelBuffer[index] = .black
- } else {
- pixelBuffer[index] = .green
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement