OtoroLin commited on
Commit
0ba52cd
·
1 Parent(s): 8bceb5f

Add zipped file hirarchy and the zipped files

Browse files
.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
  data.tar.gz filter=lfs diff=lfs merge=lfs -text
 
 
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
  data.tar.gz filter=lfs diff=lfs merge=lfs -text
61
+ *.tar.gz filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -1,2 +1 @@
1
- download_testing.py
2
- zipping.sh
 
1
+ download_testing.py
 
README.md CHANGED
@@ -21,44 +21,6 @@ task_categories:
21
  - image-segmentation
22
  task_ids: []
23
  ---
24
- ---
25
- license: mit
26
- dataset_info:
27
- config_name: data
28
- features:
29
- - name: origin
30
- dtype:
31
- array3_d:
32
- shape:
33
- - 256
34
- - 256
35
- - 172
36
- dtype: int16
37
- - name: label
38
- dtype: string
39
- - name: forgery
40
- dtype:
41
- array3_d:
42
- shape:
43
- - 256
44
- - 256
45
- - 172
46
- dtype: int16
47
- - name: method
48
- dtype: string
49
- - name: bbox
50
- sequence: int16
51
- length: 6
52
- splits:
53
- - name: train
54
- num_bytes: 10947635800
55
- num_examples: 240
56
- - name: validation
57
- num_bytes: 2736908805
58
- num_examples: 60
59
- download_size: 4651559462
60
- dataset_size: 13684544605
61
- ---
62
 
63
  # Dataset Card Creation Guide
64
 
 
21
  - image-segmentation
22
  task_ids: []
23
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  # Dataset Card Creation Guide
26
 
data.tar.gz → data/ADMM-ADAM/config0/config0.tar.gz RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:313ddddbb44d0946609a73c368eee0216919ba55c2229f5def9a754ae0c63a67
3
- size 4651559462
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:36d06c63f748c8811f3b8886ddd4ed61dfde372a664e83f900b4260134f648df
3
+ size 4638742678
data/ADMM-ADAM/config1/config1.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ea09b6453115aa8eac713b9e73a4b626e4287aee5b74f68fe5fced8e8ebdc8b
3
+ size 4641919697
data/ADMM-ADAM/config2/config2.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1b56a97086094412d674463188b65e4b35f7d8a10daeccea2dd9e6ee140847f
3
+ size 4648017518
data/ADMM-ADAM/config3/config3.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:33403bf96845f87101714722c3384b83459005b1105c7c602145b18eada9d2ea
3
+ size 4646102280
data/ADMM-ADAM/config4/config4.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fd4a1289fc196c9ee58c50eae46012ada498d4fabcf4219e6bb0eaa51c4ae906
3
+ size 4651590554
data/Origin/Origin.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:42d03c4d3d2979140a7c20314ee524bd778d05a86aa21b7bf4c7e7b01be2ed6c
3
+ size 4683062375
data/new_FastHyIn/config1/config1.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b7aa64b4f56cb99e66398100ec1b9fa9f1426ad5ce21f22d627ad11a061356b7
3
+ size 18768694062
data/new_FastHyIn/config2/config2.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6537cc80c1ababc67f3cebbbd9eedf9d1be579d22a136df48ac1edbde80c616e
3
+ size 18751654099
data/new_FastHyIn/config3/config3.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da3d973f6600e06676dc04a9267bf7b2267a87231549f670c86a409814dc0f71
3
+ size 18773148209
data/new_FastHyIn/config4/config4.tar.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bcb6ac9182b047bbb804be3d61a924668556e986838605517b2c73e651fd99b7
3
+ size 18763396934
developer_README.md ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HyperForensics++ Dataset Contribution Guide
2
+
3
+ This guide outlines the steps to contribute to the HyperForensics++ dataset repository.
4
+
5
+ ---
6
+
7
+ ## 1. Clone the Repository
8
+ First, clone the repository from Hugging Face to your local machine:
9
+ ```bash
10
+ # Make sure git-lfs is installed (https://git-lfs.com)
11
+ git lfs install
12
+ git clone https://huggingface.co/datasets/OtoroLin/HyperForensics-plus-plus
13
+ ```
14
+ ## 2. Extract the Dataset
15
+ Unzip the data.tar.gz file into a separate local directory:
16
+ ```bash
17
+ [to be filled]
18
+ ```
19
+ ## 3. Modify or Generate Data
20
+ Make changes or generate new data in the extracted directory. Ensure the data follows the required structure:
21
+ ```
22
+ local_data/
23
+ |-{attacking method}/
24
+ | |-config0/
25
+ | | |-images.npy
26
+ | |-config1/
27
+ | | ...
28
+ | |-config4/
29
+ |-{attacking method}/
30
+ | |-config{0-4}/
31
+ |-Origin
32
+ | |-images.npy
33
+ HyperForensics-plus-plus/
34
+ |-data/
35
+ ```
36
+ ## 4. Zip the Directory
37
+ After modifying or generating data, zip the directory into a `.tar.gz` file and place it in the repository.
38
+
39
+ You can utilize the provided `zipping.sh` script. First, modify the `ROOT_DIR` variable to the `local_data` path
40
+ ```bash
41
+ # In zipping.sh
42
+ # Defined the root directory of the whole dataset
43
+ ROOT_DIR="/root/to/local_data"
44
+ ```
45
+ ### 4.1 Compressing specify the method and configuration:
46
+ ```bash
47
+ ./zipping.sh --method <method name> --config <config name>
48
+ ```
49
+ Replace <method name> with the forgery method and <config name> with the configuration index. This will automatically put the compressed `.tar.gz` file under hirarchy of the dataset repo.
50
+ For instance, if I want to zip the images under `ADMM-ADAM` forgery method, `config0` configuration:
51
+ ```bash
52
+ ./zipping.sh --method ADMM-ADAM --config 0
53
+ ```
54
+ This will compress `/path/to/local/ADMM-ADAM/config0/*` to `HyperForensics-plus-plus/data/ADMM-ADAM/config0/config0.tar.gz`.
55
+ ### 4.2 Compressing the specify direcotry
56
+ ```bash
57
+ ./zipping.sh --dir-path <path/to/directory>
58
+ ```
59
+ Replace `<path/to/directory>` with the intended directory path. This will compress the directory and put it in the working directory.
60
+ For instance,
61
+ ```bash
62
+ ./zipping.sh --dir-path /path/to/local/ADMM-ADAM/config0
63
+ ```
64
+ This will compress `/path/to/local/ADMM-ADAM/config0/*` to `HyperForensics-plus-plus/config0.tar.gz`.
65
+ ### 4.3 Compress the entire hirarchy
66
+ ```bash
67
+ ./zipping.sh --all
68
+ ```
69
+ This will compress the entire local data hirarchy seperately and automatically put the compressed files under hirarchy of the dataset repo.
70
+ ## 5. Create a Pull Request
71
+ Push your changes to create a pull request. Hugging Face uses `git push` to implement pull requests:
72
+ ```bash
73
+ git push origin pr/<pr index>:refs/pr/<pr index>
74
+ ```
75
+ Replace `<pr index>` with the pull request index.
76
+ ## 6. Wait for merging the Pull Request
77
+ Once the pull request is created, the repository maintainer will review and merge it.
78
+ ---
79
+ Thank you for contributing to the HyperForensics++ dataset!
unzipping.sh ADDED
File without changes
zipping.sh ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ # Defined the root directory of the whole dataset
4
+ ROOT_DIR="/ssd2/TzuYu/data"
5
+
6
+ # Function to display usage
7
+ usage() {
8
+ echo "Usage: $0 [--method METHOD --config CONFIG] | [--dir-path DIR_PATH]"
9
+ exit 1
10
+ }
11
+ # Function to zip a single directory
12
+ zip_config() {
13
+ local method=$1
14
+ local config=$2
15
+ local dir_path="$ROOT_DIR/$method/$config"
16
+ local output_path="./data/$method/$config/$config.tar.gz"
17
+
18
+ # Ensure the output directory exists
19
+ mkdir -p "$(dirname "$output_path")"
20
+
21
+ # Create the tar.gz file
22
+ echo "Zipping $dir_path to $output_path"
23
+ tar -czvf "$output_path" "$dir_path"/*
24
+ if [[ $? -ne 0 ]]; then
25
+ echo "Error: Failed to create tar.gz for $dir_path"
26
+ exit 1
27
+ fi
28
+ }
29
+
30
+ # Parse arguments
31
+ while [[ "$#" -gt 0 ]]; do
32
+ case $1 in
33
+ --help) usage ;;
34
+ --h) usage ;;
35
+ --all) ALL="true" ;;
36
+ --method) METHOD="$2"; shift ;;
37
+ --config) CONFIG="$2"; shift ;;
38
+ --dir-path) DIR_PATH="$2"; shift ;;
39
+ *) echo "Unknown parameter: $1"; usage ;;
40
+ esac
41
+ shift
42
+ done
43
+
44
+ # zipping all folders
45
+ if [[ "$ALL" == "true" ]]; then
46
+ # Iterate through all methods and configs
47
+ for method_dir in "$ROOT_DIR"/*; do
48
+ if [[ -d "$method_dir" && "$(basename "$method_dir")" != "Origin" ]]; then
49
+ method=$(basename "$method_dir")
50
+ for config_dir in "$method_dir"/config*; do
51
+ if [[ -d "$config_dir" ]]; then
52
+ config=$(basename "$config_dir")
53
+ zip_config "$method" "$config"
54
+ fi
55
+ done
56
+ fi
57
+ done
58
+
59
+ if [ ! -e "./data/Origin/Origin.tar.gz" ]; then
60
+ # Ensure the output directory exists
61
+ mkdir -p "./data/Origin"
62
+
63
+ # Create the tar.gz file
64
+ echo "Zipping $ROOT_DIR/Origin to ./data/Origin/Origin.tar.gz"
65
+ tar -czvf "./data/Origin/Origin.tar.gz" "$ROOT_DIR"/Origin/*
66
+ if [[ $? -ne 0 ]]; then
67
+ echo "Error: Failed to create tar.gz for $ROOT_DIR/Origin"
68
+ exit 1
69
+ fi
70
+ fi
71
+ echo "All configurations have been zipped successfully."
72
+ exit 0
73
+ fi
74
+
75
+ SPECIFIED="false"
76
+
77
+ # Validate arguments
78
+ if [[ -n "$METHOD" && -n "$CONFIG" ]]; then
79
+ DIR_PATH="$ROOT_DIR/$METHOD/config$CONFIG"
80
+ SPECIFIED="true"
81
+ elif [[ -z "$DIR_PATH" ]]; then
82
+ echo "Error: Either --method and --config or --dir-path must be specified."
83
+ usage
84
+ fi
85
+
86
+ # Check if the directory exists
87
+ if [[ ! -d "$DIR_PATH" ]]; then
88
+ echo "Error: Directory $DIR_PATH does not exist."
89
+ exit 1
90
+ fi
91
+
92
+ # Extract method and config index from the directory path
93
+ METHOD=$(basename "$(dirname "$DIR_PATH")")
94
+ CONFIG=$(basename "$DIR_PATH")
95
+
96
+ # Define the output tar file name
97
+ # If directory path specified, saved to the data hirarchy
98
+ # Otherwise, saved to the repo root directory
99
+ if [[ "$SPECIFIED" == "false" ]]; then
100
+ OUTPUT_TAR="./$CONFIG.tar.gz"
101
+ else
102
+ OUTPUT_TAR="./data/$METHOD/$CONFIG/$CONFIG.tar.gz"
103
+ fi
104
+
105
+ # Ensure the output directory exists
106
+ mkdir -p "$(dirname "$OUTPUT_TAR")"
107
+
108
+ # Create the tar.gz file
109
+ echo "Zipping directory: $DIR_PATH"
110
+ tar -czvf "$OUTPUT_TAR" "$DIR_PATH"/*
111
+ if [[ $? -ne 0 ]]; then
112
+ echo "Error: Failed to create tar.gz file."
113
+ exit 1
114
+ fi
115
+
116
+ # Confirm completion
117
+ echo "Directory zipped successfully to: $OUTPUT_TAR"