Esempio n. 1
0
        public FeedbackProcessor(string qry, Dictionary<string, int> results, string outputLocation, int ft, int shp)
        {
            data = results;
            try
            {
                index = File.ReadAllLines(outputLocation);
            } catch(Exception e){
                System.Windows.Forms.MessageBox.Show("Couldn't find output file"+e);
            }

            numFeatures = ft;
            numShapes = shp;

            featureThreshold = new double[numFeatures];
            avgFeature = new double[numFeatures];
            featureRelIndex = new int[numFeatures];
            featureNotRelIndex = new int[numFeatures];

            shapeThreshold = new double[numShapes];
            avgShape = new double[numShapes];
            shapeRelIndex = new int[numShapes];
            shapeNotRelIndex = new int[numShapes];

            relShapeCount = 0;
            notRelShapeCount = 0;

            query = new ImageObj(numShapes, numFeatures, qry);
            relImages = new Dictionary<string,ImageObj>();
            notRelImages = new Dictionary<string,ImageObj>();
            untouchedImages = new Dictionary<string, ImageObj>();

            buildFeedbackDictionaries();
        }
Esempio n. 2
0
        private void buildFeedbackDictionaries()
        {
            for (int i = 0; i < index.Length; i++)
            {
                string[] sarr = index[i].Split(',');

                // Set up query obj
                if (sarr[0] == query.name)
                {
                    query.addShape(index[i]);
                }

                // Create relevant and irrelevant and untouched
                // dictionaries
                if (data.Keys.Contains(sarr[0]))
                {
                    var toStore = untouchedImages;
                    if (data[sarr[0]] < 0)
                    {
                        toStore = notRelImages;
                    } else if(data[sarr[0]] > 0){
                        toStore = relImages;
                    }

                    if (!toStore.ContainsKey(sarr[0]))
                    {
                        ImageObj o = new ImageObj(numShapes, numFeatures, sarr[0]);
                        toStore.Add(sarr[0], o);

                    }

                    toStore[sarr[0]].addShape(index[i]);
                }
            }
        }