浏览代码

1.【agent】修复读取视频失败问题
2.更新接口调用范例.py

xuan.wang 8 月之前
父节点
当前提交
98bf2709c4

+ 7 - 7
TrainSdk/接口调用范例.py

@@ -7,7 +7,7 @@ train_group_count = TrainSdk.get_train_group_count(token)
 #打印训练文件夹中的组数量
 print("Current train group count: " + str(train_group_count))
 #循环读取训练文件夹中的文件组
-for i in range(train_group_count)
+for i in range(train_group_count):
     #打印训练文件夹中的组索引
     print("Reading train group index: " + str(i) + "...")
     #获取训练文件夹中的组名称
@@ -15,13 +15,13 @@ for i in range(train_group_count)
     #获取训练文件夹中单组内的文件数量
     train_file_count = TrainSdk.get_train_file_count(token, i)
     #循环读取训练文件夹中单组内的文件
-    for j in range(train_file_count)
+    for j in range(train_file_count):
         #打印训练文件夹中单组内的文件索引
         print("Reading train file index: " + str(j) + "...")
         #获取训练文件夹中单组内的文件及其标注数据,名称,是否为视频,所属模态
         file_data, label_data, file_name, file_isVideo, file_modal = TrainSdk.get_train_file(token, i, j)
         #输出获取的文件
-        print(file_data)
+        #print(file_data)
         #输出获取的标注结果
         labeldata = json.loads(label_data)
         print(labeldata)
@@ -38,7 +38,7 @@ test_group_count = TrainSdk.get_test_group_count(token)
 #打印测试文件夹中的组数量
 print("Current test group count: " + str(test_group_count))
 #循环读取测试文件夹中的文件组
-for i in range(test_group_count)
+for i in range(test_group_count):
     #打印测试文件夹中的组索引
     print("Reading test group index: " + str(i) + "...")
     #获取测试文件夹中的组名称
@@ -46,13 +46,13 @@ for i in range(test_group_count)
     #获取测试文件夹中单组内的文件数量
     test_file_count = TrainSdk.get_test_file_count(token, i)
     #循环读取测试文件夹中单组内的文件
-    for j in range(test_file_count)
+    for j in range(test_file_count):
         #打印测试文件夹中单组内的文件索引
         print("Reading test file index: " + str(j) + "...")
         #获取测试文件夹中单组内的文件及其标注数据,名称,是否为视频,所属模态
         file_data, label_data, file_name, file_isVideo, file_modal = TrainSdk.get_test_file(token, i, j)
         #输出获取的文件
-        print(file_data)
+        #print(file_data)
         #输出获取的标注结果
         labeldata = json.loads(label_data)
         print(labeldata)
@@ -65,4 +65,4 @@ for i in range(test_group_count)
         
         
 #保存模型
-TrainSdk.save_output_model("d:\test.pb")
+#TrainSdk.save_output_model("d:\test.pb")

+ 1 - 1
aipagnt/AgentSynchronizer.cs

@@ -257,7 +257,7 @@ namespace aipagnt
                 {
                     _agentInfo.WorkingState.TaskId = CurrentTask.TaskId;
                     _agentInfo.WorkingState.State = CurrentTask.State;
-                    using (var logStream = new FileStream(CurrentTask.LogFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+                    using (var logStream = new FileStream(CurrentTask.LogFile, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite))
                     {
                         using (var streamReader = new StreamReader(logStream, Encoding.GetEncoding("GB2312")))
                         {

+ 2 - 2
aipagnt/AgentTask.cs

@@ -111,11 +111,11 @@ namespace aipagnt
                         _workingProcess.WaitForExit();
                         State = _canceled ? AgentTaskState.Canceled : AgentTaskState.Finished;
                         SqliteDbAccessor.Instance.Reset();
-                        //WriteLog("Agent state AgentTaskState.Finished _workingProcess!= null");
+                        //Logger.WriteLineInfo($"Agent state AgentTaskState.Finished _workingProcess!= null");
                     }
                     else
                     {
-                        //WriteLog("Agent state AgentTaskState.Finished _workingProcess== null");
+                        //Logger.WriteLineInfo($"Agent state AgentTaskState.Finished _workingProcess== null");
                         State = AgentTaskState.Finished;
                     }
                 });

+ 2 - 2
aipdev/FolderImageBrowser.xaml.cs

@@ -322,7 +322,7 @@ namespace aipdev
                     }
                     foreach (var folderImage in folderImages)
                     {
-                        if (_images.Any(x => x.DeveloperFolderFile.Index == folderImage.DeveloperFolderFile.Index))
+                        if (_images.Any(x => x.DeveloperFolderFile.DeveloperFolderGroupId == folderImage.DeveloperFolderFile.DeveloperFolderGroupId))
                         {
                             continue;
                         }
@@ -366,7 +366,7 @@ namespace aipdev
                     foreach (var fileInfo in labeledFileInfos)
                     {
                         var labeledUltrasoundFile = fileInfo.LabeledUltrasoundFile;
-                        if (_images.Any(x => x.LabeledUltrasoundFile.Id == labeledUltrasoundFile.Id))
+                        if (_images.Any(x => x.LabeledUltrasoundFile.UltrasoundGroupId == labeledUltrasoundFile.UltrasoundGroupId))
                         {
                             continue;
                         }

+ 1 - 1
aipsvr/Services/AgentService.cs

@@ -817,7 +817,7 @@ namespace aipsvr.Services
             {
                 case ImageDataFormat.Avi:
                 case ImageDataFormat.Mp4:
-                    var videoPath = Path.Combine(CommonConfigManager.VideoTranscodingFolder, name);
+                    var videoPath = Path.Combine(CommonConfigManager.VideoTranscodingFolder, archivedImage.Id.ToString(), archivedImage.OriginalName);
                     if (File.Exists(videoPath))
                     {
                         trainingImage.ImageData = FileToByteArray(videoPath);