Skip to content
Permalink
Browse files

temporarily save cml model

  • Loading branch information...
tobiasbaur committed Feb 26, 2019
1 parent d233a93 commit 226d9069e2feaf635edfce11751551d386573d05
@@ -111,7 +111,13 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs
{
e.Cancel = true;
}


var dir = new DirectoryInfo(Path.GetDirectoryName(Properties.Settings.Default.CMLTempTrainerPath));
foreach (var file in dir.EnumerateFiles(Path.GetFileName(Properties.Settings.Default.CMLTempTrainerPath) + "latestcmlmodel*"))
{
file.Delete();
}

}
}
}
@@ -606,7 +606,7 @@ private void annoList_SelectionChanged(object sender, SelectionChangedEventArgs
{
AnnoListItem item = (AnnoListItem)grid.SelectedItem;
control.annoListControl.editComboBox.SelectedItem = item.Label;
double samplerate = MainHandler.getMaxVideoSampleRate();
double samplerate = MainHandler.getMaxVideoSampleRate();
double offset = (1.0f / samplerate);
Time.CurrentPlayPosition = item.Start;

@@ -992,9 +992,19 @@ private void CompleteSession()
tempTrainerPath = tempTrainerPath.Trim();
tempTrainerPath = tempTrainerPath.Replace("\"", "");
var dir = new DirectoryInfo(Path.GetDirectoryName(tempTrainerPath));
if (!Directory.Exists(Properties.Settings.Default.CMLDirectory)) Directory.CreateDirectory(Properties.Settings.Default.CMLTempTrainerPath);
foreach (var file in dir.EnumerateFiles(Path.GetFileName(tempTrainerPath) + "*.trainer*"))
{
file.Delete();
string[] split = file.Name.Split('.');
split[0] = "latestcmlmodel";
string filename = string.Join(".", split);

if (File.Exists(Properties.Settings.Default.CMLTempTrainerPath + filename))
{
File.Delete(Properties.Settings.Default.CMLTempTrainerPath + filename);
}
file.MoveTo(Properties.Settings.Default.CMLTempTrainerPath + filename);
//file.Delete();
}
}

@@ -547,7 +547,7 @@ private void Apply_Click(object sender, RoutedEventArgs e)

}

if (mode == Mode.EVALUATE)
if (mode == Mode.EVALUATE)
{
string evalOutPath = Properties.Settings.Default.CMLDirectory + "\\" + Path.GetFileNameWithoutExtension(Path.GetRandomFileName());
try
@@ -589,9 +589,53 @@ private void Apply_Click(object sender, RoutedEventArgs e)
handler.ReloadAnnoTierFromDatabase(AnnoTierStatic.Selected, false);

var dir = new DirectoryInfo(Path.GetDirectoryName(tempTrainerPath));

string streamName = "";
string[] streamParts = stream.Name.Split('.');
if (streamParts.Length <= 1)
{
streamName = stream.Name;
}
else
{
streamName = streamParts[1];
for (int i = 2; i < streamParts.Length; i++)
{
streamName += "." + streamParts[i];
}
}

try
{
var tempdir = new DirectoryInfo(Path.GetDirectoryName(Properties.Settings.Default.CMLTempTrainerPath));
foreach (var file in tempdir.EnumerateFiles(Path.GetFileName(Properties.Settings.Default.CMLTempTrainerPath) + "latestcmlmodel*"))
{
file.Delete();
}
}
catch { }


Properties.Settings.Default.CMLTempTrainerPath = Properties.Settings.Default.CMLDirectory + "\\" + Defaults.CML.ModelsFolderName + "\\" + Defaults.CML.ModelsTrainerFolderName + "\\" + AnnoTier.Selected.AnnoList.Scheme.Type.ToString().ToLower() + "\\" + AnnoTier.Selected.AnnoList.Scheme.Name + "\\" + stream.Type + "{" + streamName + "}\\" + trainer.Name + "\\";
Properties.Settings.Default.Save();



if (!Directory.Exists(Properties.Settings.Default.CMLDirectory)) Directory.CreateDirectory(Properties.Settings.Default.CMLTempTrainerPath);

foreach (var file in dir.EnumerateFiles(Path.GetFileName(tempTrainerPath) + "*"))
{
file.Delete();
string[] split = file.Name.Split('.');
split[0] = "latestcmlmodel";
string filename = string.Join(".", split);

if (File.Exists(Properties.Settings.Default.CMLTempTrainerPath + filename))
{
File.Delete(Properties.Settings.Default.CMLTempTrainerPath + filename);
}
file.MoveTo(Properties.Settings.Default.CMLTempTrainerPath + filename);

//file.Delete();
}

Close();

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -152,5 +152,8 @@
<Setting Name="EnablePython" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="CMLTempTrainerPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
@@ -173,6 +173,9 @@
<setting name="EnablePython" serializeAs="String">
<value>True</value>
</setting>
<setting name="CMLTempTrainerPath" serializeAs="String">
<value />
</setting>
</ssi.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit 226d906

Please sign in to comment.
You can’t perform that action at this time.