Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

streamed not being called #85

Closed
SamuelMarks opened this issue Jul 3, 2018 · 2 comments
Closed

streamed not being called #85

SamuelMarks opened this issue Jul 3, 2018 · 2 comments

Comments

@SamuelMarks
Copy link

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Check console. Never get "streamed" message. Never get any text on the screen (unless I uncomment the "testing" one.

import UIKit
import AVFoundation
import Lumina

class MainVC: UIViewController {
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        
        LuminaViewController.loggingLevel = .verbose
        
        let camera = LuminaViewController()
        camera.delegate = self
        
        if #available(iOS 11.0, *) {
            camera.streamFrames = true
            camera.textPrompt = ""
            camera.trackMetadata = true
            camera.streamingModels = [MobileNet(), Inceptionv3()]
        } else {
            print("Warning: this iOS version doesn't support CoreML")
        }
        
        // camera.textPrompt = "testing"
        present(camera, animated: true, completion: nil)
    }
}

extension MainVC: LuminaDelegate {
    func dismissed(controller: LuminaViewController) {
        controller.dismiss(animated: true, completion: nil)
    }
    
    func streamed(videoFrame: UIImage, with predictions: [LuminaRecognitionResult]?, from controller: LuminaViewController) {
        print("streamed")
        if #available(iOS 11.0, *) {
            guard let predicted = predictions else {
                return
            }
            var resultString = String()
            for prediction in predicted {
                guard let values = prediction.predictions else {
                    continue
                }
                guard let bestPrediction = values.first else {
                    continue
                }
                resultString.append("\(String(describing: prediction.type)): \(bestPrediction.name)" + "\r\n")
            }
            controller.textPrompt = resultString
        } else {
            print("Warning: this iOS version doesn't support CoreML")
        }
    }
}

Expected behavior
Followed YouTube video. It should show predictions on screen. Currently it shows no text, and doesn't debug to console that it even hit that function. dismissed works though.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: iPhone 6S
  • OS: iOS11.4
  • Version: 1.3.1 (with the edits from my PR)

Additional context
Add any other context about the problem here.

@dokun1
Copy link
Owner

dokun1 commented Jul 3, 2018

Hi @SamuelMarks - thanks for opening the issue!

I think this means I need to re-record my video, as the interface for this changed in v1.3.0. Can you try to use the readme, which has been updated, to make your project work? The main line of code will change to:

camera.streamingModels = [LuminaModel(model: MobileNet().model, type: "MobileNet")]

You can also check the sample app for how this is done. Let me know if this works for you - if it does, then I definitely have to update the video.

@SamuelMarks
Copy link
Author

Thanks, changing to this worked:

if #available(iOS 11.0, *) {
    camera.streamingModels = [
        LuminaModel(model: MobileNet().model, type: "MobileNet"),
        LuminaModel(model: Inceptionv3().model, type: "Inceptionv3")
    ]
} else {
    print("Warning: this iOS version doesn't support CoreML")
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants