コード例 #1
0
ファイル: Supervisor.cs プロジェクト: megatrousers/GenderRec
        private void AppendResults(SubjectBatch testBatch)
        {
            Dictionary<string, string[]> resultBatch = new Dictionary<string, string[]>();
            string[] result;
            foreach (KeyValuePair<string, Subject> subject in testBatch.Subjects)
            {
                result = new string[RESULTS_PROP_NUM];
                result[0] = subject.Value.Name;
                result[1] = subject.Value.Path;
                result[2] = subject.Value.Gender.ToString();

                resultBatch.Add(subject.Value.Name, result);
            }
            resultBatches.Add(testBatch.Name, resultBatch);
        }
コード例 #2
0
ファイル: Supervisor.cs プロジェクト: megatrousers/GenderRec
        public void LoadImageSet(string path, string[] fileNames, BatchType batchType)
        {
            //Get a list of images from source
            List<BitmapImage>  imageBatch = il.Load(path, fileNames);

            //Create a dictionary of subjects from the list of images
            if( imageBatch != null )
            {
                SubjectBatch subjects = new SubjectBatch();
                subjects.Name = DEFAULT_BATCH_PREFIX + assignBatchNum++;

                for (int i = 0; i < imageBatch.Count; i++)
                {
                    Subject subject = new Subject();
                    subject.BaseImage = imageBatch.ElementAt(i);
                    subject.Path = path;
                    subject.Name = fileNames[i];
                    subject.Gender = GenderType.UNKNOWN;
                    subjects.Add(subject);
                }

                //Add the collection of new subjects to the batch list
                subjectBatches.Add(subjects.Name, subjects);
                focusBatchName = subjects.Name;
                if(!FocusSubjects.Keys.Contains(subjects.Name))
                {
                    focusSubjects.Add(focusBatchName, subjects.Subjects.Values.Last());
                }
                else
                {
                    focusSubjects[focusBatchName] = subjects.Subjects.Values.Last();
                }

            }
        }