public ConfigurationDetector(YoloConfiguration config)
 {
     _files    = new string[3];
     _files[0] = config.ConfigFile;
     _files[1] = config.WeightsFile;
     _files[2] = config.NamesFile;
 }
Beispiel #2
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="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);
        }
Beispiel #3
0
        private bool AreValidYoloFiles(YoloConfiguration config)
        {
            if (string.IsNullOrEmpty(config.ConfigFile) ||
                string.IsNullOrEmpty(config.WeightsFile) ||
                string.IsNullOrEmpty(config.NamesFile))
            {
                return(false);
            }

            return(true);
        }
Beispiel #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);
        }
Beispiel #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);
            }
        }
Beispiel #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);
 }
Beispiel #7
0
 public YoloWrapper(YoloConfiguration yoloConfiguration)
 {
     this.Initialize(yoloConfiguration.ConfigFile, yoloConfiguration.WeightsFile, yoloConfiguration.NamesFile, 0);
 }
Beispiel #8
0
 public YoloWrapper(YoloConfiguration yoloConfiguration, DetectionSystem detectionSystem)
 {
     this.Initialize(yoloConfiguration.ConfigFile, yoloConfiguration.WeightsFile, yoloConfiguration.NamesFile, 0);
 }
Beispiel #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];
 }