Example #1
0
 def get_static_analyzers(self):
     if AnalyzerTask._analyzers is None:
         AnalyzerTask._analyzers = {
             'tag': analyzer.OpenImagesAnnotator(),
             'text': analyzer.CRNNAnnotator()
         }
     return AnalyzerTask._analyzers
Example #2
0
 def get_static_analyzers(self):
     analyzers_root = "{}/analyzers/".format(settings.MEDIA_ROOT)
     if AnalyzerTask._analyzers is None:
         AnalyzerTask._analyzers = {
             'crnn':
             analyzer.CRNNAnnotator(analyzers_root + "crnn/crnn.pth")
         }
     return AnalyzerTask._analyzers
 def load_analyzer(self, da):
     if da.name not in AnalyzerTask._analyzers:
         aroot = "{}/analyzers/".format(settings.MEDIA_ROOT)
         if da.name == 'crnn':
             AnalyzerTask._analyzers[da.name] = analyzer.CRNNAnnotator(
                 aroot + "{}/crnn.pth".format(da.pk))
         else:
             raise ValueError, "analyzer by id {} not found".format(da.pk)
Example #4
0
 def load_analyzer(self, da):
     if da.name not in AnalyzerTask._analyzers:
         aroot = "{}/models/".format(settings.MEDIA_ROOT)
         if da.name == 'crnn':
             AnalyzerTask._analyzers[da.name] = analyzer.CRNNAnnotator(
                 aroot + "{}/crnn.pth".format(da.pk))
         elif da.name == 'tagger':
             AnalyzerTask._analyzers[
                 da.name] = analyzer.OpenImagesAnnotator(
                     aroot + "{}/open_images.ckpt".format(da.pk))
         else:
             raise ValueError, "analyzer by id {} not found".format(da.pk)
 def load_analyzer(self, da):
     da.ensure()
     if da.name not in Analyzers._analyzers:
         aroot = "{}/models/".format(settings.MEDIA_ROOT)
         if da.name == 'crnn':
             Analyzers._analyzers[da.name] = analyzer.CRNNAnnotator(
                 aroot + "{}/crnn.pth".format(da.uuid))
         elif da.name == 'tagger':
             Analyzers._analyzers[da.name] = analyzer.OpenImagesAnnotator(
                 aroot + "{}/open_images.ckpt".format(da.uuid))
         elif da.algorithm == 'location_net':
             Analyzers._analyzers[da.name] = analyzer.LocationNet(
                 aroot + "{}/".format(da.uuid), epoch=da.argumets['epoch'])
         else:
             raise ValueError, "analyzer by id {} not found".format(da.pk)