Python decoder.Decoder() Examples
The following are 30
code examples of decoder.Decoder().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
decoder
, or try the search function
.
Example #1
Source File: decoder_test.py From DOTA_models with Apache License 2.0 | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #2
Source File: decoder_test.py From object_detection_kitti with Apache License 2.0 | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #3
Source File: eval.py From JLM with MIT License | 6 votes |
def __init__(self): self.config = json.loads(open(os.path.join(experiment_path, str(args.experiment_id), 'config.json'), 'rt').read()) if self.config['char_rnn']: self.vocab = CharVocab(self.config['vocab_size']) else: self.vocab = Vocab(self.config['vocab_size']) self.w2i = self.vocab.w2i if args.use_ngram: self.decoder = NGramDecoder(experiment_id=args.experiment_id, ngram_order=args.ngram_order) elif self.config['char_rnn']: self.decoder = CharRNNDecoder(experiment_id=args.experiment_id, comp=args.comp) elif args.dynamic_decoding: self.decoder = DynamicDecoder(experiment_id=args.experiment_id, comp=args.comp) else: self.decoder = Decoder(experiment_id=args.experiment_id, comp=args.comp)
Example #4
Source File: decoder_test.py From hands-detection with MIT License | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #5
Source File: decoder_test.py From object_detection_with_tensorflow with MIT License | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #6
Source File: decoder_test.py From ECO-pytorch with BSD 2-Clause "Simplified" License | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #7
Source File: decoder_test.py From HumanRecognition with MIT License | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #8
Source File: decoder_test.py From Action_Recognition_Zoo with MIT License | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #9
Source File: decoder_test.py From g-tensorflow-models with Apache License 2.0 | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #10
Source File: decoder_test.py From Gun-Detector with Apache License 2.0 | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #11
Source File: decoder_test.py From models with Apache License 2.0 | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #12
Source File: decoder_test.py From yolo_v2 with Apache License 2.0 | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #13
Source File: decoder_test.py From multilabel-image-classification-tensorflow with MIT License | 6 votes |
def testCodesFromCTC(self): """Tests that the simple CTC decoder drops nulls and duplicates. """ ctc_labels = [9, 9, 9, 1, 9, 2, 2, 3, 9, 9, 0, 0, 1, 9, 1, 9, 9, 9] decode = decoder.Decoder(filename=None) non_null_labels = decode._CodesFromCTC( ctc_labels, merge_dups=False, null_label=9) self.assertEqual(non_null_labels, [1, 2, 2, 3, 0, 0, 1, 1]) idempotent_labels = decode._CodesFromCTC( non_null_labels, merge_dups=False, null_label=9) self.assertEqual(idempotent_labels, non_null_labels) collapsed_labels = decode._CodesFromCTC( ctc_labels, merge_dups=True, null_label=9) self.assertEqual(collapsed_labels, [1, 2, 3, 0, 1, 1]) non_idempotent_labels = decode._CodesFromCTC( collapsed_labels, merge_dups=True, null_label=9) self.assertEqual(non_idempotent_labels, [1, 2, 3, 0, 1])
Example #14
Source File: decoder_test.py From HumanRecognition with MIT License | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #15
Source File: decoder_test.py From g-tensorflow-models with Apache License 2.0 | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #16
Source File: decoder_test.py From object_detection_with_tensorflow with MIT License | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #17
Source File: decoder_test.py From models with Apache License 2.0 | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #18
Source File: decoder_test.py From object_detection_kitti with Apache License 2.0 | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #19
Source File: decoder_test.py From multilabel-image-classification-tensorflow with MIT License | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #20
Source File: style_transfer_net.py From arbitrary_style_transfer with MIT License | 5 votes |
def __init__(self, encoder_weights_path): self.encoder = Encoder(encoder_weights_path) self.decoder = Decoder()
Example #21
Source File: decoder_test.py From hands-detection with MIT License | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #22
Source File: closed_caption.py From arib with Apache License 2.0 | 5 votes |
def parse_contents(f, bytes_to_read): ''' Do complex reading of caption data from binary file. Return a list of statements and characters ''' if DEBUG: print 'going to read {bytes} bytes in binary file caption statement.'.format(bytes=bytes_to_read) statements = [] bytes_read = 0 #TODO: Check to see if decoder state is carred between packet processing #currently recreating the decoder (and therefore resetting its state) #on every packet paylod processing. This may be incorrect decoder = Decoder() line = '' while bytes_read<bytes_to_read: statement = decoder.decode(f) if statement: bytes_read += len(statement) statements.append(statement) #if isinstance(statement, code_set.Kanji) or isinstance(statement, code_set.Alphanumeric) \ # or isinstance(statement, code_set.Hiragana) or isinstance(statement, code_set.Katakana): # if DEBUG: # print statement #just dump to stdout for now # line += str(statement) #if len(line)>0: # print '{l}\n'.format(l=line) return statements
Example #23
Source File: decoder_test.py From ECO-pytorch with BSD 2-Clause "Simplified" License | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #24
Source File: decoder_test.py From Action_Recognition_Zoo with MIT License | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #25
Source File: controller.py From NAS-Benchmark with GNU General Public License v3.0 | 5 votes |
def __init__(self, encoder_layers, encoder_vocab_size, encoder_hidden_size, encoder_dropout, encoder_length, source_length, encoder_emb_size, mlp_layers, mlp_hidden_size, mlp_dropout, decoder_layers, decoder_vocab_size, decoder_hidden_size, decoder_dropout, decoder_length, ): super(NAO, self).__init__() self.encoder = Encoder( encoder_layers, encoder_vocab_size, encoder_hidden_size, encoder_dropout, encoder_length, source_length, encoder_emb_size, mlp_layers, mlp_hidden_size, mlp_dropout, ) self.decoder = Decoder( decoder_layers, decoder_vocab_size, decoder_hidden_size, decoder_dropout, decoder_length, encoder_length ) self.init_parameters() self.flatten_parameters()
Example #26
Source File: decoder_test.py From Gun-Detector with Apache License 2.0 | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #27
Source File: decoder_test.py From yolo_v2 with Apache License 2.0 | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')
Example #28
Source File: controller.py From NAO_pytorch with GNU General Public License v3.0 | 5 votes |
def __init__(self, encoder_layers, encoder_vocab_size, encoder_hidden_size, encoder_dropout, encoder_length, source_length, encoder_emb_size, mlp_layers, mlp_hidden_size, mlp_dropout, decoder_layers, decoder_vocab_size, decoder_hidden_size, decoder_dropout, decoder_length, ): super(NAO, self).__init__() self.encoder = Encoder( encoder_layers, encoder_vocab_size, encoder_hidden_size, encoder_dropout, encoder_length, source_length, encoder_emb_size, mlp_layers, mlp_hidden_size, mlp_dropout, ) self.decoder = Decoder( decoder_layers, decoder_vocab_size, decoder_hidden_size, decoder_dropout, decoder_length, encoder_length ) self.flatten_parameters()
Example #29
Source File: controller.py From NAO_pytorch with GNU General Public License v3.0 | 5 votes |
def __init__(self, encoder_layers, encoder_vocab_size, encoder_hidden_size, encoder_dropout, encoder_length, source_length, encoder_emb_size, mlp_layers, mlp_hidden_size, mlp_dropout, decoder_layers, decoder_vocab_size, decoder_hidden_size, decoder_dropout, decoder_length, ): super(NAO, self).__init__() self.encoder = Encoder( encoder_layers, encoder_vocab_size, encoder_hidden_size, encoder_dropout, encoder_length, source_length, encoder_emb_size, mlp_layers, mlp_hidden_size, mlp_dropout, ) self.decoder = Decoder( decoder_layers, decoder_vocab_size, decoder_hidden_size, decoder_dropout, decoder_length, encoder_length ) self.flatten_parameters()
Example #30
Source File: decoder_test.py From DOTA_models with Apache License 2.0 | 5 votes |
def testStringFromCTC(self): """Tests that the decoder can decode sequences including multi-codes. """ # - f - a r - m(1/2)m -junk sp b a r - n - ctc_labels = [9, 6, 9, 1, 3, 9, 4, 9, 5, 5, 9, 5, 0, 2, 1, 3, 9, 4, 9] decode = decoder.Decoder(filename=_testdata('charset_size_10.txt')) text = decode.StringFromCTC(ctc_labels, merge_dups=True, null_label=9) self.assertEqual(text, 'farm barn')