Browse Source

create README.md

zhengbochao 2 weeks ago
parent
commit
39c1265b7e
4 changed files with 17 additions and 224 deletions
  1. 14 0
      README.md
  2. BIN
      a/DSC_0452.jpg
  3. 0 222
      a/DSC_0452.json
  4. 3 2
      datamange/mask2small_classification.py

+ 14 - 0
README.md

@@ -0,0 +1,14 @@
+项目位置:249服务器 /data/fengyang/sunwin/code/swin_conda_env/Wildfire目录下面
+
+1. 标注好的数据放在datamage目录下,其中图片存放在images目录下,json文件存放在json目录下
+2. 运行datamange/createMask.py文件将datamange/data/json目录下的标注文件转化成mask图像,存放在同目录的mask目录下
+3. 运行datamange/mask2small_classification.py文件将512*512图像切成128*128(可自行更改)小块,并结合mask图像将切分出来的图片区分成有烟或无烟的两种分类样本,最终数据存放在dadamange/result_class目录中
+4. 将生成好的result_class数据区分训练集和测试集后,将训练集数据放入Wildfire/Swin-Transformer/imagemet/train/目录下,测试集数据放入Swin-Transformer/imagemet/test/目录下
+5. 运行Swin-Transformer/目录下的train.sh脚本即可开始训练
+
+推理
+1. 将视频裁成图片,并且将图片resize成512*512大小后,将图片切成128*128的小块保存,并记录每块小图对应原图的原始位置,方便后续拼接还原
+2. 运行val.sh脚本 --datapath是需要推理图片的路径 --resume 是训练好的模型。最终得到图像分类的结果信息
+3. 将结果通过每小块图像的位置对应到原图上去,得到最终的推理结果
+
+

BIN
a/DSC_0452.jpg


File diff suppressed because it is too large
+ 0 - 222
a/DSC_0452.json


+ 3 - 2
datamange/mask2small_classification.py

@@ -40,6 +40,7 @@ def cut_small_images(image_path, mask_path, pic_target='./result_class/'):
     num_length = int(length / cut_length)
     # for循环迭代生成
     lines_list = []
+    print(image_path)
     for i in range(0, num_width):
         for j in range(0, num_length):
             im = image[i * cut_width: (i + 1) * cut_width, j * cut_length: (j + 1) * cut_length, :]
@@ -66,8 +67,8 @@ def cut_small_images(image_path, mask_path, pic_target='./result_class/'):
             cv2.imwrite(result_path, im)
 
 if __name__ == '__main__':
-    masks_dir_path = './data1/mask'
-    images_dir_path = './data1/images'
+    masks_dir_path = './data/mask'
+    images_dir_path = './data/images'
     # masks_dir_path = './data/test/mask'
     # images_dir_path = './data/fire'
     images_list_path = os.listdir(images_dir_path)

Some files were not shown because too many files changed in this diff