XiC1 commited on
Commit
5d2e8bb
·
verified ·
1 Parent(s): d67c45e

Upload folder using huggingface_hub

Browse files
data/source.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:223bcdb7ad9628bd3542ed1883b4456e99633a15fba7daac112b6a6c6d5cc40d
3
+ size 1191720960
data/test/nailong.tar CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ef9e7c1396472eb1a8e79d4185d02a08c9250f83b57bdcae377e323b33800e31
3
- size 56064000
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84529dc0543d9b53a092a48b6ef9c33bda11497b6e596208f4a903a6e054e27c
3
+ size 82227200
data/test/other.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5221b471bf7da2057c987fb93c035e565157579d38e74696465b481409167d38
3
+ size 209571840
data/train/nailong.tar CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:2ff6b5ee7affa6d45a6519ac304ed6a895c665f0882cbbd4f1d3ce0b8aacfabe
3
- size 390215680
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2bbb5e77bcf2a23744884c7d77f44d7bbf80e8ca26a08d02a5c04e99c6afd71a
3
+ size 212848640
data/train/other.tar ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:beefd4b3dcaa39896d36ae69856a3bc0d560ed51fb5664440d04bb30062d6dd9
3
+ size 2139873280
tar.sh CHANGED
@@ -8,36 +8,36 @@
8
  # @description : tar datas
9
  ######################################################################
10
 
11
- index=(0 1 2 3)
12
- splits=("train/bqb" "train/nailong" "test/bqb" "test/nailong")
13
- lables=(0 1 0 1)
14
  source_dir='source' # 源目录
15
  data_dir='data' # data目录
16
 
17
  rm -r $data_dir
18
- #mkdir $data_dir
19
- cp -r $source_dir $data_dir
20
- # 遍历 splits 数组中的每个元素
21
- for idx in "${index[@]}"; do
22
- split=${splits[$idx]}
23
- #cp -r "$source_dir/$split" "$data_dir/$splits"
24
- folder="$data_dir/$split"
25
 
26
- # 检查目录是否存在
27
- if [ -d "$folder" ]; then
28
- echo "找到文件夹: $(basename "$folder")"
 
 
 
 
 
29
 
30
- lable=${lables[$idx]}
 
 
 
 
 
31
 
 
32
 
33
- #echo $folder
34
- python ./convert2PNG.py "$folder"/*
35
-
36
- python ./generate_info.py "lable=${lables[$idx]}" "$folder"/*
37
 
38
- tar -cvf "$data_dir/$split.tar" -C "$folder" . && rm -rf "$folder"
39
- else
40
- echo "目录 $folder 不存在,跳过。"
41
- fi
42
  done
43
-
 
8
  # @description : tar datas
9
  ######################################################################
10
 
11
+ subdirs=("train" "test")
 
 
12
  source_dir='source' # 源目录
13
  data_dir='data' # data目录
14
 
15
  rm -r $data_dir
16
+ mkdir $data_dir
 
 
 
 
 
 
17
 
18
+ # 遍历 train 和 test 目录
19
+ for subdir in "${subdirs[@]}"; do
20
+ # 获取子目录下的所有文件夹
21
+ cp -r $source_dir/$subdir $data_dir/$subdir
22
+ folders=$(find "$data_dir/$subdir" -mindepth 1 -maxdepth 1 -type d)
23
+
24
+ for folder in $folders; do
25
+ folder_name=$(basename "$folder")
26
 
27
+ # 设置标签
28
+ if [ "$folder_name" == "nailong" ]; then
29
+ label=1
30
+ else
31
+ label=0
32
+ fi
33
 
34
+ echo "处理文件夹: $folder_name, 标签: $label"
35
 
36
+ # 执行 Python 脚本
37
+ #python ./convert2PNG.py "$folder"/*
38
+ python ./generate_info.py "label=$label" "$folder"/*
 
39
 
40
+ # 压缩文件夹并删除原文件夹
41
+ tar -cf "$data_dir/$subdir/$folder_name.tar" -C "$folder" . && rm -rf "$folder"
42
+ done
 
43
  done