public ConfigurationDetector(YoloConfiguration config)
 {
     _files    = new string[3];
     _files[0] = config.ConfigFile;
     _files[1] = config.WeightsFile;
     _files[2] = config.NamesFile;
 }
예제 #2
0
파일: YoloWrapper.cs 프로젝트: csuffyy/Igor
        /// <summary>
        /// Initialize Yolo
        /// </summary>
        /// <param name="yoloConfiguration"></param>
        /// <param name="ignoreGpu">Disable automatic gpu detection</param>
        /// <exception cref="NotSupportedException">Thrown when the process not run in 64bit</exception>
        /// <exception cref="YoloInitializeException">Thrown if an error occurs during initialization</exception>
        public YoloWrapper(YoloConfiguration yoloConfiguration, GpuConfig gpuConfig = null, IYoloSystemValidator yoloSystemValidator = null)
        {
            if (yoloSystemValidator == null)
            {
                this._yoloSystemValidator = new DefaultYoloSystemValidator();
            }

            this.Initialize(yoloConfiguration.ConfigFile, yoloConfiguration.WeightsFile, yoloConfiguration.NamesFile, gpuConfig);
        }
예제 #3
0
        private bool AreValidYoloFiles(YoloConfiguration config)
        {
            if (string.IsNullOrEmpty(config.ConfigFile) ||
                string.IsNullOrEmpty(config.WeightsFile) ||
                string.IsNullOrEmpty(config.NamesFile))
            {
                return(false);
            }

            return(true);
        }
예제 #4
0
        private bool AreValidYoloFiles(YoloConfiguration config)
        {
            if (string.IsNullOrEmpty(config.ConfigFile) ||
                string.IsNullOrEmpty(config.WeightsFile) ||
                string.IsNullOrEmpty(config.NamesFile))
            {
                return(false);
            }

            if (Path.GetFileNameWithoutExtension(config.ConfigFile) != Path.GetFileNameWithoutExtension(config.WeightsFile))
            {
                return(false);
            }

            return(true);
        }
예제 #5
0
        public bool Initialize(YoloConfiguration configuration)
        {
            try
            {
                var result = tr_context_new(configuration.ConfigFile, configuration.NamesFile, configuration.WeightsFile);
                if (result == -1)
                {
                    return(false);
                }

                return(true);
            }
            catch (Exception exception)
            {
                return(false);
            }
        }
예제 #6
0
 /// <summary>
 /// Initialize Yolo
 /// </summary>
 /// <param name="yoloConfiguration"></param>
 /// <param name="ignoreGpu">Disable automatic gpu detection</param>
 /// <exception cref="NotSupportedException">Thrown when the process not run in 64bit</exception>
 /// <exception cref="DllNotFoundException">Thrown when Microsoft Visual C++ 2017 Redistributable not available</exception>
 /// <exception cref="IndexOutOfRangeException">Thrown when the gpu index is not valid</exception>
 public YoloWrapper(YoloConfiguration yoloConfiguration, bool ignoreGpu = false)
 {
     this.Initialize(yoloConfiguration.ConfigFile, yoloConfiguration.WeightsFile, yoloConfiguration.NamesFile, 0, ignoreGpu);
 }
예제 #7
0
 public YoloWrapper(YoloConfiguration yoloConfiguration)
 {
     this.Initialize(yoloConfiguration.ConfigFile, yoloConfiguration.WeightsFile, yoloConfiguration.NamesFile, 0);
 }
예제 #8
0
 public YoloWrapper(YoloConfiguration yoloConfiguration, DetectionSystem detectionSystem)
 {
     this.Initialize(yoloConfiguration.ConfigFile, yoloConfiguration.WeightsFile, yoloConfiguration.NamesFile, 0);
 }
예제 #9
0
 /// <summary>
 /// Initialize Yolo
 /// </summary>
 /// <param name="yoloConfiguration"></param>
 /// <param name="ignoreGpu">Disable automatic gpu detection</param>
 /// <exception cref="NotSupportedException">Thrown when the process not run in 64bit</exception>
 /// <exception cref="DllNotFoundException">Thrown when Microsoft Visual C++ 2017 Redistributable not available</exception>
 /// <exception cref="IndexOutOfRangeException">Thrown when the gpu index is not valid</exception>
 public YoloWrapper(YoloConfiguration yoloConfiguration, bool ignoreGpu = false)
 {
     this.Initialize(yoloConfiguration.ConfigFile, yoloConfiguration.WeightsFile, yoloConfiguration.NamesFile, 0, ignoreGpu);
     this._headerBuffer = new byte[_imageAnalyzer.MinHeaderSize];
 }