Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. for i in 0..<size {
  2. for j in 0..<size {
  3. var scores: [Float] = []
  4. for k in 0..<depth {
  5. let index = i * size * depth + j * depth + k
  6. let score = array[index]
  7. scores.append(score)
  8. }
  9. if let maxScore = scores.max(),
  10. let maxClass = scores.firstIndex(of: maxScore) {
  11. let index = i * size + j
  12.  
  13. if maxClass == 0 {
  14. pixelBuffer[index] = .blue
  15. } else if maxClass == 12 {
  16. pixelBuffer[index] = .black
  17. } else {
  18. pixelBuffer[index] = .green
  19. }
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement