public IEnumerator GetProductDescription() { // output message to user. yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("Αναγνώριση προϊόντος"))); float startOCRt = Time.realtimeSinceStartup; //ocr annotation. yield return(StartCoroutine(OCRAnnotator.PerformAnnotation(camTexture))); annotationText = OCRAnnotator.GetAnnotationResults <string>(); float endOCRt = Time.realtimeSinceStartup; OCRtime = CalculateTimeDifference(startOCRt, endOCRt); if (!string.IsNullOrEmpty(annotationText)) { string product_formatted; float startMajt = Time.realtimeSinceStartup; var wordsOCR = GenericUtils.SplitStringToList(annotationText); var product_desc = MajorityVoting.GetProductDesciption(wordsOCR); product_formatted = FormatDescription(product_desc); float endMajt = Time.realtimeSinceStartup; Majoritytime = CalculateTimeDifference(startMajt, endMajt); SetResultLogs(); yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText(product_formatted.ToLower()))); } }
private void Awake() { annotator = GetComponent <IAnnotate>(); httpLoader = GetComponent <HttpImageLoading>(); majVoting = new MajorityVoting(); SetSVM(); }
// Start is called before the first frame update void Start() { //GetReturnValue().WrapErrors(); MajorityVoting maj = new MajorityVoting(); maj.ReadDatabaseFile("masoutis_db"); }
public void ReadDocumentTitles(string filename) { var lines = File.ReadAllLines(filename); var list = new List <string>(lines); docTitlesList = MajorityVoting.RemoveGreekAccentSequential(list); Debug.Log("dimarxeio db loaded"); }
private string FormatDescription(string product) { var edit = GenericUtils.SplitStringToList(product); edit = MajorityVoting.KeepElementsWithLen(edit, 4); var description = GenericUtils.ListToString(edit); return(description); }
//Load database public IEnumerator LoadDatabase() { annotationProccessBusy = true; MajorityVoting.LoadDatabaseFiles(MajorityVoting.masoutisFiles); while (MajorityVoting.database_ready != true) { yield return(null); } annotationProccessBusy = false; }
public async void GetProductDescription(Texture2D camTex) { // output message to user. UAP_AccessibilityManager.Say("Αναγνώριση Προϊόντος"); resultTextPanel.text = "Αναγνώριση προϊόντος"; float startOCRt = Time.realtimeSinceStartup; //ocr annotation. annotationText = await annotator.PerformAnnotation(camTex); float endOCRt = Time.realtimeSinceStartup; OCRtime = CalculateTimeDifference(startOCRt, endOCRt); if (!string.IsNullOrEmpty(annotationText) && annotationText != "GCFAILED") { float startMajt = Time.realtimeSinceStartup; var wordsOCR = SplitStringToList(annotationText); OCRLogs = GenericUtils.ListToString(wordsOCR); var valid_words = MajorityVoting.GetValidWords(wordsOCR); validWordsLogs = GenericUtils.ListToString(valid_words); string product_formatted = FormatDescription(ListToString(valid_words)); if (MajorityValidText != null) { MajorityValidText = product_formatted; } majorityFinal = product_formatted; float endMajt = Time.realtimeSinceStartup; Majoritytime = CalculateTimeDifference(startMajt, endMajt); text_result = product_formatted.ToLower(); } else if (annotationText == "GCFAILED") { text_result = "Η σύνδεση στο δίκτυο είναι απενεργοποιημένη."; } else { text_result = "Δεν αναγνωρίστηκαν λέξεις"; } productAnnotationDone = true; }
IEnumerator SaveList(string path) { MajorityVoting maj = new MajorityVoting(); maj.ReadDatabaseFile("masoutis_db_ScanS"); while (!MajorityVoting.database_ready) { yield return(null); } StreamWriter writer = new StreamWriter(path, true); foreach (string s in MajorityVoting.desc) { writer.WriteLine(s); } writer.Close(); Debug.Log("File written"); }
public IEnumerator TestMajorityVoring() { MajorityVoting maj = new MajorityVoting(); yield return(maj.PerformMajorityVoting(words)); }
public IEnumerator GetTrailShelfDescription(int category) { // output message to user. yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("Παρακαλώ περιμένετε"))); float startOCRt = Time.realtimeSinceStartup; //ocr annotation. yield return(StartCoroutine(OCRAnnotator.PerformAnnotation(camTexture))); annotationText = OCRAnnotator.GetAnnotationResults <string>(); float endOCRt = Time.realtimeSinceStartup; OCRtime = CalculateTimeDifference(startOCRt, endOCRt); // Perform majority voting MajorityVoting majVoting = new MajorityVoting(); if (!string.IsNullOrEmpty(annotationText)) { float startMajt = Time.realtimeSinceStartup; List <string> OCR_List = GenericUtils.SplitStringToList(annotationText); yield return(StartCoroutine(majVoting.PerformMajorityVoting(OCR_List))); float endMajt = Time.realtimeSinceStartup; Majoritytime = CalculateTimeDifference(startMajt, endMajt); switch (category) { case (int)Enums.MasoutisCategories.trail: process_result = majVoting.masoutis_item.category_2; yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("διάδρομος, " + process_result))); break; case (int)Enums.MasoutisCategories.shelf: process_result = majVoting.masoutis_item.category_4; yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("ράφι, " + process_result))); break; case (int)Enums.MasoutisCategories.other: yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("άλλο, " + "μη αναγνωρίσιμο"))); break; default: break; } } else { switch (category) { case (int)Enums.MasoutisCategories.trail: process_result = "Δεν αναγνωρίστηκαν διαθέσιμες λέξεις"; yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("διάδρομος, " + process_result))); break; case (int)Enums.MasoutisCategories.shelf: process_result = "Δεν αναγνωρίστηκαν διαθέσιμες λέξεις"; yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("ράφι, " + process_result))); break; case (int)Enums.MasoutisCategories.other: yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("άλλο, " + "μη αναγνωρίσιμο"))); break; default: break; } if (ApplicationView.MajorityFinalText != null) { ApplicationView.MajorityFinalText.text = "Δεν αναγνωρίστηκαν διαθέσιμες λέξεις"; } if (ApplicationView.MajorityValidText != null) { ApplicationView.MajorityValidText.text = "κενό"; } yield return(StartCoroutine(voiceSynthesizer.PerformSpeechFromText("Δεν αναγνωρίστηκαν διαθέσιμες λέξεις"))); } }
async Task GetReturnValue() { Debug.Log("read database: " + Time.realtimeSinceStartup); MajorityVoting maj = new MajorityVoting(); // call with await the IENUMA Debug.Log("Database is read"); }