def handleObject(self):
     from photonix.classifiers.object import ObjectModel, run_on_photo
     print('Loading object classification model')
     model = ObjectModel()
     threaded_queue_processor = ThreadedQueueProcessor(
         model, 'classify.object', run_on_photo, num_workers, batch_size)
     threaded_queue_processor.run(loop=False)
    def handleLocaltion(self):
        from photonix.classifiers.location import LocationModel, run_on_photo
        print('Loading object location model')
        model = LocationModel()

        threaded_queue_processor = ThreadedQueueProcessor(
            model, 'classify.location', run_on_photo, num_workers, batch_size)
        threaded_queue_processor.run(loop=False)
Beispiel #3
0
def test_classifier_batch(photo_fixture_snow):
    photo = PhotoFactory()
    PhotoFileFactory(photo=photo)

    for i in range(4):
        TaskFactory(subject_id=photo.id)

    start = time()

    threaded_queue_processor = ThreadedQueueProcessor(model, 'classify.style', run_on_photo, 1, 64)
    threaded_queue_processor.run(loop=False)

    assert time() - start > 0
    assert time() - start < 100
    assert photo.photo_tags.count() == 1
    assert photo.photo_tags.all()[0].tag.name == 'serene'
    assert photo.photo_tags.all()[0].confidence > 0.9
Beispiel #4
0
 def run_processors(self):
     num_workers = 4
     batch_size = 64
     threaded_queue_processor = ThreadedQueueProcessor(
         model, 'classify.style', run_on_photo, num_workers, batch_size)
     threaded_queue_processor.run()