gelato271 commited on
Commit
2b7129b
1 Parent(s): f088392

Restore readme

Browse files
Files changed (1) hide show
  1. README.md +80 -0
README.md CHANGED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ ## Instructions to run
4
+
5
+ #### Docker
6
+ All of the below commands should be run in a Docker container built using the Dockerfile in the repo, with the data and repo being exposed as volumes in the container.
7
+
8
+ To build:
9
+
10
+ ```docker build -t benchmarks_img .```
11
+
12
+ To run an interactive shell:
13
+
14
+ ```docker run -it --shm-size=2G --gpus all -v /path/to/neurips2023-benchmarks:/neurips2023-benchmarks -v /path/to/datasets/:/data benchmarks_img```
15
+
16
+
17
+ ### Analysis Task
18
+
19
+ In the analysis part, two folder are available, one for the classification comparison with the results in the appendix and another one for the regression comparison in the benchmark section (section 5.1).
20
+
21
+ First, the path to the dataset must be correctly initialized in the config.py file in analysis/regression and analysis/classification, the variable DATA_DIR must lead to the dataset with the folders images/, metadata/ and the file metadata.json.
22
+
23
+ To run the code for regression or classification :
24
+ ```bash
25
+ python3 train.py --model_name resnet18 --size 224 --cropped True --device 0
26
+ ```
27
+
28
+ Replace the arguments with your desired values:
29
+
30
+ - `--device`: The index of the GPU device to use (0 by default) (e.g. number between 0 and the number of devices in your GPU, run ```nvidia-smi``` for more infos).
31
+ - `--size`: Input image size (e.g., 512).
32
+ - `--cropped`: Whether to use cropped images (True or False).
33
+
34
+ The train.py files are the entry points of the code. And then it basically follows the PytorchLightning workflow :
35
+ https://lightning.ai/docs/pytorch/stable/starter/introduction.html
36
+
37
+ #### Regression
38
+ More specifically to run the regression code :
39
+ ```bash
40
+ cd analysis/regression
41
+ python3 train.py --model_name resnet18 --labels wind --size 224 --cropped True --device 0
42
+ ```
43
+ In this case more arguments can be changed :
44
+ - `--model_name`: The architecture of the model (e.g., "resnet18", "resnet50").
45
+ - `--label`: The target label for regression (e.g., "wind", "pressure").
46
+
47
+ By changing the arguments you can obtain the results of the tables 2 and 3 in the paper.
48
+
49
+ A pipeline is also provided which trains all the benchmarks in a row:
50
+ ```bash
51
+ cd analysis/regression
52
+ python3 pipeline.py --device 0
53
+ ```
54
+
55
+ #### Classification
56
+ To run the classification code :
57
+ ```bash
58
+ cd analysis/classification
59
+ python3 train.py --model_name vgg --size 224 --cropped True --device 0
60
+ ```
61
+ In this case, the model_name possibilities are different :
62
+ - `--model_name`: The architecture of the model (e.g., "resnet18", "vgg", "vit").
63
+
64
+ Same as above, a pipeline in the classification folder launch all the training of the classification benchmarks in a row:
65
+ ```bash
66
+ cd analysis/classification
67
+ python3 pipeline.py --device 0
68
+ ```
69
+
70
+ #### Results visualisation
71
+ The results are saved in a /analysis/[classification,regression]/results/
72
+
73
+ Folders with names depending of the arguments are created after a training and it creates different version after a few tries. It is managed by the pytorch_lightning.loggers TensorboardLogger : https://lightning.ai/docs/pytorch/stable/extensions/generated/lightning.pytorch.loggers.TensorBoardLogger.html#tensorboardlogger
74
+
75
+ To visualize the results you can launch the command
76
+ ```bash
77
+ tensorboard --logdir /results/[training_name]/version_X/
78
+ ```
79
+ And then open the local link given in a browser.
80
+