Ejemplo n.º 1
0
        void btnGetResultForTrecEval_Click(object sender, EventArgs e)
        {
            // load index for search
            IndexStorage textCaptionIndexStorage = new IndexStorage(ConfigCommon.CAPTION_INDEX_STORAGE);

            textCaptionIndexStorage.OpenIndexStore();

            // read queries
            Dictionary <string, string> dicQueries = ReadTopicFile(ConfigEvaluation.topicFile);

            foreach (var item in dicQueries)
            {
                Console.WriteLine(string.Format("'{0}'", item.Value));
            }

            // search for each query
            FileStream fs = File.Create(ConfigEvaluation.resultsFile);

            fs.Close();
            StreamWriter sw = new StreamWriter(ConfigEvaluation.resultsFile);

            foreach (var query in dicQueries)
            {
                // example: 301	Q0	FR940202-2-00150	104	  2.129133	STANDARD
                List <float>  listScores;
                List <Object> listTextCaptions = Searching.SearchByQueryPlusScore(textCaptionIndexStorage, ConfigCommon.TOP_RANK, query.Value, SearchType.CAPTION, out listScores);
                if (listTextCaptions == null)
                {
                    sw.Write(query.Key + "\tQ0\tNULL\tNULL\tNULL\tNULL\n");
                    continue;
                }

                HashSet <string> hsDocRetrieval = new HashSet <string>();
                List <float>     listScoresNew  = new List <float>();
                for (int i = 0; i < listTextCaptions.Count; i++)
                {
                    string docRetrieval = GetDocRetrieval(((TextCaption)listTextCaptions[i]).FrameName);
                    if (!hsDocRetrieval.Contains(docRetrieval))
                    {
                        hsDocRetrieval.Add(docRetrieval);
                        listScoresNew.Add(listScores[i]);
                    }
                    if (hsDocRetrieval.Count == numNumberOfTopGet.Value)
                    {
                        break;
                    }
                }
                for (int i = 0; i < hsDocRetrieval.Count; i++)
                {
                    //string docRelevanced = GetDocRelevanced(((TextCaption)listTextCaptions[i]).FrameName);
                    string record = string.Format("{0}\tQ0\t{1}\t{2}\t{3}\tRUN_0", query.Key, hsDocRetrieval.ElementAt(i), (i + 1), listScoresNew[i]);
                    //Console.WriteLine(record);
                    sw.Write(record + "\n");
                }
                Console.WriteLine(query.Key);
            }
            sw.Close();
            Console.WriteLine("Finish");
        }
Ejemplo n.º 2
0
        void VideoBrowsingForm_Load(object sender, EventArgs e)
        {
            textSpotingIndexStorage = new IndexStorage(ConfigCommon.TEXTSPOTTING_INDEX_STORAGE);
            textSpotingIndexStorage.OpenIndexStore();

            textCaptionIndexStorage = new IndexStorage(ConfigCommon.CAPTION_INDEX_STORAGE);
            textCaptionIndexStorage.OpenIndexStore();

            mappingVideoName = FileManager.GetInstance().GetDictionaryVideoName(ConfigCommon.MAPPING_VIDEO_NAME_PATH);
            mappingFPS       = XMLParser.GetFPSDictionary(ConfigCommon.FPS_VIDEO_PATH);

            pctIndexingData = PCTIndexing.LoadImageIndexStrorageV2(ConfigCommon.PCT_INDEX_STORAGE);
        }
Ejemplo n.º 3
0
        void btnTextSpotIndexing_Click(object sender, EventArgs e)
        {
            btnTextSpotIndexing.Enabled = false;
            List <TextSpot> textSpot     = FileManager.GetInstance().DeserializeJson(ConfigCommon.TEXT_PLOTTING_PATH);
            IndexStorage    indexStorage = new IndexStorage(ConfigCommon.TEXTSPOTTING_INDEX_STORAGE);

            indexStorage.OpenIndexStore();

            Indexing.IndexFromDatabaseStorage(indexStorage, textSpot);

            indexStorage.CloseIndexStorage();

            btnTextSpotIndexing.Enabled = true;
        }
Ejemplo n.º 4
0
        public IndexProcessing()
        {
            InitializeComponent();
            btnTextCaptionIndexing.Click += btnTextCaptionIndexing_Click;
            btnTextSpotIndexing.Click    += btnTextSpotIndexing_Click;
            btnParseXML.Click            += btnParseXML_Click;
            btnParseJson.Click           += btnParseJson_Click;
            btnSearchCap.Click           += btnSearchCap_Click;

            textCaptionStorage = new IndexStorage(ConfigCommon.CAPTION_INDEX_STORAGE);
            textCaptionStorage.OpenIndexStore();

            textSpotIndexStorage = new IndexStorage(ConfigCommon.TEXTSPOTTING_INDEX_STORAGE);
            textSpotIndexStorage.OpenIndexStore();
        }
Ejemplo n.º 5
0
        void btnTextCaptionIndexing_Click(object sender, EventArgs e)
        {
            btnTextCaptionIndexing.Enabled = false;

            lblStatus.Text = "Convert Data Json to List TextCaption";

            lblStatus.Text = "Create IndexStorage";
            IndexStorage indexStorage = new IndexStorage(ConfigCommon.CAPTION_INDEX_STORAGE);

            indexStorage.OpenIndexStore();

            //FileInfo[] files = FileManager.GetInstance().GetAllFileInFolder(ConfigCommon.TEXT_CAPTION_PATH);
            //foreach (FileInfo f in files)
            //{
            //    List<TextCaption> caption = JsonConvert.DeserializeObject<List<TextCaption>>(FileManager.GetInstance().ReadContentFile(f.FullName));
            //    Console.WriteLine(caption.Count);
            //    lblStatus.Text = "Indexing....";
            //    Indexing.IndexFromDatabaseStorage(indexStorage, caption);
            //}
            List <TextCaption> caption = ReadTextCaptionsIndex(@"D:\SoureThesis\Data\textcaption_old.txt");

            Console.WriteLine(caption.Count);
            lblStatus.Text = "Indexing....";
            Indexing.IndexFromDatabaseStorage(indexStorage, caption);

            //int numberOfJsonFiles = 3;
            //for (int i = 0; i < numberOfJsonFiles; i++)
            //{
            //    List<TextCaption> _caption = ReadTextCaptionsIndex("textcaption_" + i + ".txt");
            //    Indexing.IndexFromDatabaseStorage(indexStorage, _caption);
            //}



            lblStatus.Text = "Close IndexStorage";
            indexStorage.CloseIndexStorage();
            btnTextCaptionIndexing.Enabled = true;
        }