コード例 #1
0
        /// <summary>
        /// Create a new instance of the <see cref="CenterFace"/> class with the specified parameter.
        /// </summary>
        /// <param name="parameter">The parameter.</param>
        /// <returns>The <see cref="CenterFace"/> this method creates.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="parameter"/> is null.</exception>
        /// <exception cref="ArgumentException">The model binary file is null or whitespace. Or the param file is null or whitespace.</exception>
        /// <exception cref="FileNotFoundException">The model binary file is not found. Or the param file is not found.</exception>
        public static CenterFace Create(CenterFaceParameter parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }
            if (string.IsNullOrWhiteSpace(parameter.BinFilePath))
            {
                throw new ArgumentException("The model binary file is null or whitespace", nameof(parameter.BinFilePath));
            }
            if (string.IsNullOrWhiteSpace(parameter.ParamFilePath))
            {
                throw new ArgumentException("The param file is null or whitespace", nameof(parameter.ParamFilePath));
            }
            if (!File.Exists(parameter.BinFilePath))
            {
                throw new FileNotFoundException("The model binary file is not found.");
            }
            if (!File.Exists(parameter.ParamFilePath))
            {
                throw new FileNotFoundException("The param file is not found.");
            }

            return(new CenterFace(parameter));
        }
コード例 #2
0
        private CenterFace(CenterFaceParameter parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }

            this._Net = new Net();
            this._Net.LoadParam(parameter.ParamFilePath);
            this._Net.LoadModel(parameter.BinFilePath);
        }
コード例 #3
0
 public static CenterFace Create(CenterFaceParameter parameter)
 {
     return(new CenterFace(parameter));
 }
コード例 #4
0
 private CenterFace(CenterFaceParameter parameter)
 {
     this._Net = new Net();
     this._Net.LoadParam(parameter.ParamFilePath);
     this._Net.LoadModel(parameter.BinFilePath);
 }