Ir para conteúdo
Fórum Script Brasil
  • 0

kartter

Pergunta

Bom dia,

Tem como eu executar o arquivo em anexo no windows?

no cmd, digito train.py e recebo de retorno os comandos linus não reconhecidos no windows.

'rm' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
Processing: ./br/input\lbr.brazil.exp0.box
Executing: c:   esseract/tesseract -l eng ./br/input/lbr.brazil.exp0.tif lbr.brazil.exp0 nobatch box.train.stderr
'mv' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
'mv' não é reconhecido como um comando interno

O código do arquivo segue abaixo

#!/usr/bin/python

import os
import glob
import sys


#TESSERACT_DIR='/storage/projects/alpr/libraries/tesseract-ocr'
TESSERACT_DIR = 'c:\tesseract'

os.environ["TESSDATA_PREFIX"] = TESSERACT_DIR
#os.system("export TESSDATA_PREFIX=" + TESSERACT_DIR)

TESSERACT_BIN=TESSERACT_DIR + '/tesseract'
TESSERACT_TRAINDIR= TESSERACT_DIR + '/training'


country = input("Two-Letter Country Code to Train: ").lower()

LANGUAGE_NAME='l' + country

box_files = glob.glob('./' + country + '/input/*.box')
if not box_files:
    print ("Cannot find input files")
    sys.exit(1)

os.system("rm ./tmp/*")
#os.system("del ./tmp/*")

font_properties_file = open('./tmp/font_properties','w')

for box_file in box_files:
    print ("Processing: " + box_file)

    file_without_dir = os.path.split(box_file)[1]
    file_without_ext = os.path.splitext(file_without_dir)[0]
    input_dir = os.path.dirname(box_file)

    tif_file = input_dir + '/' + file_without_ext + ".tif"

    train_cmd = "%s -l eng %s %s nobatch box.train.stderr" % (TESSERACT_BIN, tif_file, file_without_ext)
    print ("Executing: " + train_cmd) 
    os.system(train_cmd)
    os.system("mv ./" + file_without_ext + ".tr ./tmp/" + file_without_ext + ".tr")
    os.system("mv ./" + file_without_ext + ".txt ./tmp/" + file_without_ext + ".txt")

    font_name=file_without_dir.split('.')[1]
    font_properties_file.write(font_name + ' 0 0 1 0 0\n')

font_properties_file.close()

os.system(TESSERACT_TRAINDIR + "/unicharset_extractor ./" + country + "/input/*.box")
#os.system('mv ./unicharset ./" + country + "/input/" + LANGUAGE_NAME + ".unicharset')

# Shape clustering should currently only be used for the "indic" languages
#train_cmd = TESSERACT_TRAINDIR + '/shapeclustering -F ./' + country + '/input/font_properties -U unicharset ./' + country + '/input/*.tr'
#print "Executing: " + train_cmd
#os.system(train_cmd)


train_cmd = TESSERACT_TRAINDIR + '/mftraining -F ./tmp/font_properties -U unicharset -O ./tmp/' + LANGUAGE_NAME + '.unicharset ./tmp/*.tr'
print ("Executing: " + train_cmd)
os.system(train_cmd)
os.system("rm ./unicharset")
os.system("mv ./tmp/" + LANGUAGE_NAME + ".unicharset ./")
os.system("cp ./" + country + "/input/unicharambigs ./" + LANGUAGE_NAME + ".unicharambigs")


os.system(TESSERACT_TRAINDIR + '/cntraining ./tmp/*.tr')

#os.system("mv ./unicharset ./" + LANGUAGE_NAME + ".unicharset")
os.system("mv ./shapetable ./" + LANGUAGE_NAME + ".shapetable")
#os.system("rm ./shapetable")
os.system("mv ./pffmtable ./" + LANGUAGE_NAME + ".pffmtable")
os.system("mv ./inttemp ./" + LANGUAGE_NAME + ".inttemp")
os.system("mv ./normproto ./" + LANGUAGE_NAME + ".normproto")


os.system(TESSERACT_TRAINDIR + '/combine_tessdata ' + LANGUAGE_NAME + '.')

# If a config file is in the country's directory, use that.
config_file = os.path.join('./', country, country + '.config')
if os.path.isfile(config_file):
    print ("Applying config file: " + config_file)
    trainedata_file = LANGUAGE_NAME + '.traineddata'
    os.system(TESSERACT_TRAINDIR + '/combine_tessdata -o ' + trainedata_file + ' ' + config_file )

os.system("mv ./" + LANGUAGE_NAME + ".unicharset ./tmp/")
os.system("mv ./" + LANGUAGE_NAME + ".shapetable ./tmp/")
os.system("mv ./" + LANGUAGE_NAME + ".pffmtable ./tmp/")
os.system("mv ./" + LANGUAGE_NAME + ".inttemp ./tmp/")
os.system("mv ./" + LANGUAGE_NAME + ".normproto ./tmp/")
os.system("mv ./" + LANGUAGE_NAME + ".unicharambigs ./tmp/")

 

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

  • 0

Estou tentando treinar OpenALPR em Linux (Ubuntu 16.04 LTS) e não sou nenhum especialista, tenho tido muitas dificuldades, mas creio que dê sim para executar, mas você teria que instalar alguma ferramenta que traduzisse do Linux para DOS, que existe sim e acho que já usei. Não me recordo se era a git, GNU plot... Mas dê uma olhada nisso antes, que achei numa rápida pesquisa no Google, que indica que era o bash shell:
https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
Avise se necessitar de ajuda com o inglês da página.

Obs: Há muitos resultados se você mandar no google: how to execute linux commands in windows

Boa sorte para nós com esse OpenALPR!
Att.

Editado por Fábio Vieira
adicionar informações
Link para o comentário
Compartilhar em outros sites

  • 0

Hello, 

Check this ANPR software for home security https://www.videoanalitika.lt/en:

Recognize license plates from many countries in real time without triggers;
Work with different sources: IP cameras, WEB cameras, analog cameras connected through video cards, video files (AVI, MP4) and photos;
Control devices (barriers, lights, etc.);
Send emails and display alarms in user screen on events;
Communicate with GSM device;
Send data with POST or GET commands to your web server;
Has it‘s own web client server;
Much more...

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,8k
×
×
  • Criar Novo...