forked from TensorStack-AI/TensorStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtractorModel.cs
More file actions
63 lines (53 loc) · 2.25 KB
/
ExtractorModel.cs
File metadata and controls
63 lines (53 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) TensorStack. All rights reserved.
// Licensed under the Apache 2.0 License.
using System.IO;
using TensorStack.Common;
using TensorStack.Extractors.Common;
namespace TensorStack.Extractors.Models
{
/// <summary>
/// Default Extractor ModelSession.
/// </summary>
public class ExtractorModel : ModelSession<ExtractorConfig>
{
private ExtractorModel(ExtractorConfig configuration)
: base(configuration) { }
/// <summary>
/// The channels the model supports 1 = Greyscale, RGB = 3, RGBA = 4.
/// </summary>
public int Channels => Configuration.Channels;
/// <summary>
/// The models input maximum size (0 = Any)
/// </summary>
public int SampleSize => Configuration.SampleSize;
/// <summary>
/// The models expected input normalization (0-1 or -1-1)
/// </summary>
public Normalization Normalization => Configuration.Normalization;
/// <summary>
/// The models required output normalization
/// </summary>
public Normalization OutputNormalization => Configuration.OutputNormalization;
/// <summary>
/// The channels the model supports 1 = Greyscale, RGB = 3, RGBA = 4.
/// </summary>
public int OutputChannels => Configuration.OutputChannels;
/// <summary>
/// Gets a value indicating whether the model output shape is dynamic/calculated
/// </summary>
/// <value><c>true</c> if this instance is dynamic output; otherwise, <c>false</c>.</value>
public bool IsDynamicOutput => Configuration.IsDynamicOutput;
/// <summary>
/// Create a ExtractorModel with the specified ExtractorConfig
/// </summary>
/// <param name="configuration">The configuration.</param>
/// <returns>ExtractorModel.</returns>
/// <exception cref="System.IO.FileNotFoundException">ExtractorModel not found</exception>
public static ExtractorModel Create(ExtractorConfig configuration)
{
if (!File.Exists(configuration.Path))
throw new FileNotFoundException("ExtractorModel not found", configuration.Path);
return new ExtractorModel(configuration);
}
}
}