Beispiel #1
0
 /// <summary>
 /// Reads a network model stored in Tensorflow model file from stream.
 /// </summary>
 /// <param name="bufferModel">buffer containing the content of the pb file</param>
 /// <param name="bufferConfig">buffer containing the content of the pbtxt file (optional)</param>
 /// <returns></returns>
 /// <remarks>This is shortcut consisting from createTensorflowImporter and Net::populateNet calls.</remarks>
 public static Net?ReadNetFromTensorflow(Stream bufferModel, Stream?bufferConfig = null)
 {
     if (bufferModel == null)
     {
         throw new ArgumentNullException(nameof(bufferModel));
     }
     return(Net.ReadNetFromTensorflow(
                bufferModel.StreamToArray(),
                bufferConfig?.StreamToArray()));
 }
Beispiel #2
0
        /// <summary>
        /// Reads a network model stored in Tensorflow model file from memory.
        /// </summary>
        /// <param name="modelData">An array containing the data of a Tensorflow model</param>
        /// <param name="configData">An array contaiing the data of the pbtxt file (optional)</param>
        /// <returns></returns>
        /// <remarks>This is shortcut consisting from createTensorflowImporter and Net::populateNet calls.</remarks>
        public static Net ReadNetFromTensorflow(byte[] modelData, byte[] configData = null)
        {
            if (modelData == null)
            {
                throw new ArgumentNullException(nameof(modelData));
            }
            if (modelData.Length > int.MaxValue)
            {
                throw new ArgumentException("Not supported array (too long)");
            }

            return(Net.ReadNetFromTensorflow(modelData, configData));
        }
Beispiel #3
0
 /// <summary>
 /// Reads a network model stored in Tensorflow model file.
 /// </summary>
 /// <param name="model"></param>
 /// <param name="config"></param>
 /// <returns></returns>
 /// <remarks>This is shortcut consisting from createTensorflowImporter and Net::populateNet calls.</remarks>
 public static Net ReadNetFromTensorflow(string model, string?config = null)
 {
     return(Net.ReadNetFromTensorflow(model, config));
 }
Beispiel #4
0
 /// <summary>
 /// Reads a network model stored in Tensorflow model file from memory.
 /// </summary>
 /// <param name="bufferModel">buffer containing the content of the pb file</param>
 /// <param name="bufferConfig">buffer containing the content of the pbtxt file (optional)</param>
 /// <returns></returns>
 /// <remarks>This is shortcut consisting from createTensorflowImporter and Net::populateNet calls.</remarks>
 public static Net?ReadNetFromTensorflow(byte[] bufferModel, byte[]?bufferConfig = null)
 {
     return(Net.ReadNetFromTensorflow(bufferModel, bufferConfig));
 }