Skip to content

Commit 1740a6f

Browse files
authored
Model development (#20)
* add model blocks and tests * add model and tests * add torch to setup * add torch to requirements * update workflow * add data loader and tests * add opencv to requirements * add opencv to requirements and setup * update opencv version * implement attention mechanism in unet * add network visualisations * update readme * add visualisations * update requirements * devcontainer tweaks * tweak devcontainer * minor changes to setup.sh- add safe directory * add utils func to make images to npy * update dockerfile * test training * complete training
1 parent b84d048 commit 1740a6f

File tree

14 files changed

+243
-50
lines changed

14 files changed

+243
-50
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,8 @@ cython_debug/
162162
# Datasets
163163
data/
164164
*.npy
165+
166+
# Experiments
167+
./experiment/
168+
*.pth
169+
./wandb/

.pre-commit-config.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ repos:
77
- id: check-yaml
88
- id: check-added-large-files
99

10-
- repo: https://github.com/psf/black
11-
rev: 21.9b0 # Use the version you prefer
12-
hooks:
13-
- id: black
14-
args: ['--safe']
10+
# - repo: https://github.com/psf/black
11+
# rev: 21.9b0 # Use the version you prefer
12+
# hooks:
13+
# - id: black
14+
# args: ['--safe']
15+
1516

1617
- repo: https://github.com/pycqa/flake8
1718
rev: 3.9.2 # Use the version you prefer

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Current File",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal",
13+
"justMyCode": true
14+
}
15+
]
16+
}

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ RUN apt clean && \
88
rm -rf /var/lib/apt/lists/* && \
99
apt-get update && \
1010
apt-get install -y wget \
11+
# apt-get install -y libgl1-mesa-glx \
12+
1113
git -y && \
1214
wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
1315
/bin/bash ~/miniconda.sh -b -p /opt/miniconda

notebooks/test_unet.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@
122122
"name": "python",
123123
"nbconvert_exporter": "python",
124124
"pygments_lexer": "ipython3",
125-
"version": "3.8.10"
125+
"version": "3.8.18"
126+
126127
}
127128
},
128129
"nbformat": 4,

scripts/dataset.zip

Whitespace-only changes.

scripts/download_data.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/bash
2+
3+
# Check if an argument was provided
4+
if [ "$#" -ne 1 ]; then
5+
echo "Usage: $0 YOUR_ONEDRIVE_SHARE_LINK"
6+
exit 1
7+
fi
8+
9+
# The OneDrive shared link is the first argument
10+
onedrive_link="$1"
11+
12+
# Convert the OneDrive share link to a direct download link
13+
direct_link=$(echo $onedrive_link | sed 's/redir?/download?/')
14+
15+
# Set the name of the file to download to
16+
output_filename="dataset.zip"
17+
18+
# Use wget or curl to download the file
19+
# Uncomment the line for the tool you have available
20+
21+
# Using wget
22+
wget -O "$output_filename" "$direct_link"
23+
24+
# Using curl
25+
# curl -L "$direct_link" -o "$output_filename"
26+
27+
echo "Download complete: $output_filename"

scripts/git_update.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# Navigate to your repository directory
4+
# cd /path/to/your/repo
5+
6+
# Function to set git user configuration
7+
setup_git_config() {
8+
echo "Configuring git user information..."
9+
echo "Enter your git user email:"
10+
read git_email
11+
git config --global user.email "$git_email"
12+
13+
echo "Enter your git user name:"
14+
read git_name
15+
git config --global user.name "$git_name"
16+
}
17+
18+
# Check if git user is set, if not set it
19+
git_user_name=$(git config --global user.name)
20+
git_user_email=$(git config --global user.email)
21+
22+
if [[ -z "$git_user_name" || -z "$git_user_email" ]]; then
23+
setup_git_config
24+
fi
25+
26+
# Check git status
27+
git status
28+
29+
# Add changes to the index
30+
git add .
31+
32+
# Prompt user for a commit message
33+
echo "Enter commit message:"
34+
read commit_message
35+
36+
# Commit changes
37+
git commit -m "$commit_message"
38+
39+
# Push changes to the remote repository
40+
echo "Pushing to remote repository..."
41+
git push
42+
43+
echo "Git operations completed."

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'matplotlib',
1414
'pandas',
1515
'torch ~= 2.0',
16+
'torchvision',
1617
'opencv-python <=4.8.0.74'
1718
],
1819
extras_require={
@@ -26,5 +27,5 @@
2627
packages=find_packages(
2728
include=['underwater_unet', 'underwater_unet*'],
2829
exclude=['tests', 'tests.*', 'notebooks']
29-
),
30+
),
3031
)

test.jpg

823 Bytes
Loading

0 commit comments

Comments
 (0)