Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ python code/predictor.py --prediction-path "prediction.tif" \\
For the 5-fold training run
```
python code/main.py train --results-dir models --data-path /data
```
```

```
!python code/train.py --data-path /content/floatingobjects/data --snapshot-path /content/floatingobjects/models/model.pth.tar --image-size 128 --epochs 50 --tensorboard-logdir /content/floatingobjects/models/runs/

```

#### Load pretrained models using PyTorch Hub
Here you can load the models with pretrained weights from the 2-fold training of U-Net and MA-Net, according to what has been published in [OCEANS Conference Paper](https://210507-004.oceansvirtual.com/view/content/skdwP611e3583eba2b/ecf65c2aaf278557ad05c213247d67a54196c9376a0aed8f1875681f182daeed)
Expand Down
11 changes: 1 addition & 10 deletions code/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,17 @@
"accra_20181031",
"biscay_20180419",
"danang_20181005",
"kentpointfarm_20180710",
"kolkata_20201115",
"lagos_20190101",
"lagos_20200505",
"london_20180611",
"longxuyen_20181102",
"mandaluyong_20180314",
"neworleans_20200202",
"panama_20190425",
"portalfredSouthAfrica_20180601",
"riodejaneiro_20180504",
"sandiego_20180804",
"sanfrancisco_20190219",
"shengsi_20190615",
"suez_20200403",
"tangshan_20180130",
"toledo_20191221",
"tungchungChina_20190922",
"tunisia_20180715",
"turkmenistan_20181030",
"venice_20180630",
"venice_20180928",
"vungtau_20180423"
Expand Down Expand Up @@ -249,4 +240,4 @@ def line_is_closed(linestringgeometry):
coordinates = np.stack(linestringgeometry.xy).T
first_point = coordinates[0]
last_point = coordinates[-1]
return bool((first_point == last_point).all())
return bool((first_point == last_point).all())
21 changes: 14 additions & 7 deletions code/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@
parser.add_argument('storepath', type=str, nargs='?', default=os.path.join(this_folder, "..", "data"))
args = parser.parse_args()

print(f"creating {os.path.abspath(args.storepath)}")
# Ensure the directory exists
print(f"Creating {os.path.abspath(args.storepath)}")
os.makedirs(args.storepath, exist_ok=True)

# download
print(f"downloading {URL} to {os.path.abspath(args.storepath)}")
gdown.download(URL, args.storepath, quiet=False)
# Specify the path including the filename where the file will be saved
zip_path = os.path.join(args.storepath, "data.zip")

# unpack
print(f"unpacking {args.storepath}/data.zip to {os.path.abspath(args.storepath)}")
shutil.unpack_archive(os.path.join(args.storepath, "data.zip"), os.path.join(args.storepath, ".."))
# Download
print(f"Downloading {URL} to {zip_path}")
gdown.download(URL, zip_path, quiet=False)

# Unpack
print(f"Unpacking {zip_path} to {os.path.abspath(args.storepath)}")
shutil.unpack_archive(zip_path, os.path.abspath(args.storepath))

# Optionally, you can delete the zip file after unpacking if it's no longer needed
# os.remove(zip_path)