Skip to content

Commit e35e1eb

Browse files
committed
- build path correctly
- don't upload video and audio files
1 parent a0e72dc commit e35e1eb

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/imgclass.net/Service.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public void TrainModel(double ratio, int passes)
7979
if (!list.Any(x => x.name == _modelName))
8080
{
8181
MyLog("No models found, trying to load saved model...");
82-
if (File.Exists(_modelName + ".machinebox.classificationbox"))
82+
if (File.Exists(Path.Combine(_basePath, _modelName + ".machinebox.classificationbox")))
8383
{
8484
svc.LoadModel(Path.Combine(_basePath, _modelName + ".machinebox.classificationbox"));
8585
ret = svc.ListModels();
@@ -151,7 +151,7 @@ public void ClassifyImages(string imagesPath, double threshold)
151151
if (!list.Any(x => x.name == _modelName))
152152
{
153153
MyLog("No models found, trying to load saved model...");
154-
if (File.Exists(_modelName + ".machinebox.classificationbox"))
154+
if (File.Exists(Path.Combine(_basePath, _modelName + ".machinebox.classificationbox")))
155155
{
156156
svc.LoadModel(Path.Combine(_basePath, _modelName + ".machinebox.classificationbox"));
157157
ret = svc.ListModels();
@@ -189,9 +189,12 @@ public void ClassifyImages(string imagesPath, double threshold)
189189
protected List<FileEntry> LoadFiles(string basePath)
190190
{
191191
MyLog("Reading files...");
192+
var ignoredExts = new List<string>() { ".mp4", ".mp3", ".json" };
192193
var list = new List<FileEntry>();
193194
foreach (var filename in Directory.GetFiles(basePath))
194195
{
196+
if (ignoredExts.Contains(Path.GetExtension(filename).ToLower())) continue;
197+
195198
list.Add(new FileEntry() { fn = filename });
196199
}
197200
return list;

0 commit comments

Comments
 (0)