├── .gitignore
├── LICENSE
├── README.md
├── img
└── sample.png
└── rebuttal.tex
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Oleg
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://python.org)
2 |
3 | # ML/AI project description
4 | A simple and well designed structure is essential for any Deep Learning project - **simplicity, best practice for folder structure**.
5 |
6 | ## Changes and updates
7 | - 26-07-2022: Added the ```/rebuttal.tex``` template to address the reviewers' comments in a non-chaotic structured way
8 |
9 | Include your architecture image:
10 |
11 |
12 |
13 |
14 |
15 | Sample caption
16 |
17 |
18 |
19 | # Requirements
20 | ## Specification of dependencies
21 | - [PyTorch](https://pytorch.org/) (An open source deep learning platform)
22 | - [ignite](https://github.com/pytorch/ignite) (High-level library to help with training neural networks in PyTorch)
23 |
24 | If for some reason you choose not to use Anaconda, you must install the following frameworks and packages on your system:
25 | * Python 3.7
26 | * Pytorch x.x.x
27 | * h5py
28 | * python-socketio
29 | * scikit-image
30 |
31 | # Data
32 | Provide a link to a downloadable version of the dataset or simulation environment. For new data collected, a description of the data collection process, such as instructions to annotators and methods for quality control (e.g, CVAT was used etc.).
33 |
34 | # Experiment
35 | In a nutshell here's how to use this project, so **for example** assume you want to implement ResNet-18 to train mnist, so you should do the following:
36 | - In `modeling` folder create a python file named whatever you like, here we named it `example_model.py` . In `modeling/__init__.py` file, you can build a function named `build_model` to call your model
37 |
38 | ```python
39 | from .example_model import ResNet18
40 |
41 | def build_model(cfg):
42 | model = ResNet18(cfg.MODEL.NUM_CLASSES)
43 | return model
44 | ```
45 |
46 | - In `engine` folder create a model trainer function and inference function. In trainer function, you need to write the logic of the training process, you can use some third-party library to decrease the repeated stuff.
47 | ## Training your Model
48 | ```python
49 | # trainer
50 | def do_train(cfg, model, train_loader, val_loader, optimizer, scheduler, loss_fn):
51 | """
52 | implement the logic of epoch:
53 | -loop on the number of iterations in the config and call the train step
54 | -add any summaries you want using the summary
55 | """
56 | pass
57 |
58 | # inference
59 | def inference(cfg, model, val_loader):
60 | """
61 | implement the logic of the train step
62 | - run the tensorflow session
63 | - return any metrics you need to summarize
64 | """
65 | pass
66 | ```
67 |
68 | - In `tools` folder, you create the `train.py` . In this file, you need to get the instances of the following objects "Model", "DataLoader”, “Optimizer”, and config
69 | ```python
70 | # create instance of the model you want
71 | model = build_model(cfg)
72 |
73 | # create your data generator
74 | train_loader = make_data_loader(cfg, is_train=True)
75 | val_loader = make_data_loader(cfg, is_train=False)
76 |
77 | # create your model optimizer
78 | optimizer = make_optimizer(cfg, model)
79 | ```
80 | ## Custom scores, loss functions
81 | Please specify any custom metrics you use:
82 |
83 |
84 |
85 | And how:
86 | ```python
87 | def tversky_loss(beta):
88 | def loss(y_true, y_pred):
89 | numerator = tf.reduce_sum(y_true * y_pred, axis=-1)
90 | denominator = y_true * y_pred + beta * (1 - y_true) * y_pred + (1 - beta) * y_true * (1 - y_pred)
91 |
92 | return 1 - (numerator + 1) / (tf.reduce_sum(denominator, axis=-1) + 1)
93 |
94 | return loss
95 | ```
96 | ## Important details
97 | For all reported experimental results, check if you include:
98 | - The range of hyper-parameters considered, method to select the best hyper-parameter configuration, and specification of all hyper-parameters used to generate results.
99 |
100 | # Project structure
101 | You may find useful one of the ready-to-use file structure generators, if needed:
102 |
103 | https://github.com/ramonmoraes/structure-generator
104 |
105 | Or simply use
106 | ```
107 | git ls-tree -r master --name-only
108 | ```
109 | This repo has following directory structure:
110 | ```
111 | .
112 | ├───code
113 | │ ├───data_acquisition_exploration
114 | │ ├───deployment
115 | │ └───modelling
116 | ├───data
117 | │ ├───exploration
118 | │ ├───processed
119 | │ └───raw
120 | └───docs
121 | ├───data_reports
122 | |───final_reports
123 | └───project_reports
124 | ```
125 |
126 | The data directory is organized as follows:
127 | ```
128 | data/runs - contains the results of prediction runs
129 | data/train/images - contains images for the training set
130 | data/train/masks - contains masked (labeled) images for the training set
131 | data/validation/images - contains images for the validation set
132 | data/validation/masks - contains masked (labeled) images for the validation set
133 | data/weights - contains trained models
134 |
135 | data/raw_sim_data/train/run1
136 | data/raw_sim_data/validation/run1
137 | ```
138 |
139 | # Todo
140 | -hyper parameter search template
141 |
142 | # Citing
143 |
144 | If you use this package in your publications or in other work, please cite it as follows:
145 |
146 | ```
147 | @misc{ronneberger2015unet,
148 | title={U-Net: Convolutional Networks for Biomedical Image Segmentation},
149 | author={Olaf Ronneberger and Philipp Fischer and Thomas Brox},
150 | year={2015},
151 | eprint={1505.04597},
152 | archivePrefix={arXiv},
153 | primaryClass={cs.CV}
154 | }
155 | ```
156 | # Maintainer
157 | Email, name
158 |
--------------------------------------------------------------------------------
/img/sample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/olegrgv/ml-msc-template/63a3dd51a77c214e17f52fd511ae488c4f43c430/img/sample.png
--------------------------------------------------------------------------------
/rebuttal.tex:
--------------------------------------------------------------------------------
1 | % LaTeX rebuttal letter example.
2 |
3 | \documentclass[12pt,review]{elsarticle}
4 | \usepackage[utf8]{inputenc}
5 | \usepackage{fullpage}
6 | \usepackage{framed} % to add frames around comments
7 | \usepackage{color, soul}
8 | \usepackage{xcolor}
9 | \usepackage{tcolorbox}
10 | \tcbuselibrary{skins, breakable, theorems}
11 |
12 | \usepackage{xifthen}
13 | % define counters for reviewers and their points
14 | \newcounter{reviewer}
15 | \setcounter{reviewer}{0}
16 | \newcounter{point}[reviewer]
17 | \setcounter{point}{0}
18 |
19 | % This refines the format of how the reviewer/point reference will appear.
20 | \renewcommand{\thepoint}{P\,\thereviewer.\arabic{point}}
21 |
22 | % command declarations for reviewer points and our responses
23 | \newcommand{\reviewersection}{\stepcounter{reviewer} \bigskip \hrule
24 | \section*{Reviewer \thereviewer}}
25 |
26 | \newenvironment{point}
27 | {\refstepcounter{point} \bigskip \noindent {\textbf{Reviewer~Point~\thepoint} } ---\ \color{blue}}
28 | {\par}
29 |
30 | \newenvironment{revision}[2][]
31 | {\begin{tcolorbox}[breakable, enhanced, colback = yellow,
32 | title = Revision \thepoint \ #2,#1,
33 | colbacktitle = red!85!black, colframe = red!75!black
34 | ]\normalfont}
35 | {\par\end{tcolorbox}}
36 |
37 | \newcommand{\shortpoint}[1]{\refstepcounter{point} \bigskip \noindent
38 | {\textbf{Reviewer~Point~\thepoint} } ---~#1\par }
39 |
40 | \newenvironment{reply}
41 | {\medskip \noindent \textbf{Reply}:\ \begin{sf}}
42 | {\medskip \end{sf}}
43 |
44 | \newcommand{\shortreply}[2][]{\medskip \noindent \begin{sf}\textbf{Reply}:\ #2
45 | \ifthenelse{\equal{#1}{}}{}{ \hfill \footnotesize (#1)}%
46 | \medskip \end{sf}}
47 |
48 | % Line & Page
49 | \newcommand{\linepage}[2]{
50 | \rightline{\textbf{Line #1, Page #2}}
51 | }
52 |
53 | \def\myauthor{Author 1 \footnote{
54 | Author 1 Department
55 | }
56 | , Author 2 \footnote{
57 | Author 2 Department
58 | }} % Author
59 |
60 | \def\mycoauthor{Name Surname, Co-author}
61 | \def\mytitle{Paper Title} % title
62 | \def\myarticleno{Manuscript TCI-01902-2022}
63 | \def\mydate{\today} % date
64 |
65 | \begin{document}
66 | \setulcolor{blue}
67 | \setstcolor{red}
68 | \sethlcolor{yellow}
69 |
70 | \begin{titlepage}
71 | \noindent \textbf{\myarticleno} \\
72 | \mytitle \\
73 | \myauthor
74 | \begin{center}
75 | \vspace{1cm}
76 |
77 | \Large \textbf{Response to Editors \& Reviewers}
78 |
79 | \vspace{1cm}
80 | \end{center}
81 |
82 | \begin{tcolorbox}[title = To editors and reviewers]
83 |
84 |
85 | Dear editors and reviewers:
86 |
87 | \quad We are very grateful to the anonymous reviewers and editors for their invaluable time and effort in reviewing our manuscript and particularly providing constructive comments and suggestions for significantly improving the manuscript.
88 |
89 | \quad By carefully considering the comments and suggestions provided by the referees, revisions have been made and the main changes are summarized below.
90 | \begin{itemize}
91 | \item ...
92 | \item ...
93 | \item ...
94 | \end{itemize}
95 | \mycoauthor \\
96 | \mydate
97 | \end{tcolorbox}
98 |
99 | \end{titlepage}
100 |
101 | \section*{RREPLY TO EDITORS \& REVIEWERS}
102 | % General intro text goes here
103 | Again, we would like to express our gratitude to all reviewers and the Editors for their time and effort in reviewing and processing our manuscript and especially providing constructive comments and valuable suggestions for significantly improving the manuscript. Following these comments and suggestions, we have made changes in the revised manuscript. A point-by-point reply to the reviewer’s comments is given below, where in each case we quote the referee’s comments and then explain how we have revised the paper to accommodate the revisions requested.
104 | For easy cross-referencing, the comments are \textcolor{blue}{marked in blue} while our responses are in \begin{sf}black sans serif fontmat\end{sf}. Meanwhile, the contents in the revised paper are \hl{highlighted by yellow shading}.
105 |
106 | % Let's start point-by-point with Reviewer 1
107 | \reviewersection
108 | \textcolor{blue}{Points summary.}
109 |
110 | \begin{reply}
111 | Reply summary.
112 | \end{reply}
113 |
114 | % Point one description
115 | \begin{point}
116 | Sub Point 1.
117 | \end{point}
118 |
119 | % Our reply
120 | \begin{reply}
121 | Sub Reply 1
122 | \begin{revision}{}
123 | Revision content.
124 | \par \linepage{27-29}{7}
125 | \end{revision}
126 | \end{reply}
127 |
128 | \begin{point}
129 | Sub Point 2.
130 | \end{point}
131 |
132 | \begin{reply}
133 | Sub reply 2.
134 | \begin{revision}{}
135 | Revision content.
136 | \par \linepage{27-29}{7}
137 | \end{revision}
138 | \end{reply}
139 |
140 | \reviewersection
141 | \reviewersection
142 |
143 | \end{document}
144 |
--------------------------------------------------------------------------------