Comments (9)
Hi, sorry for closing that issue - I didn't treat "excuse me" as contempt, and english is also not my native language. Could you please share the problem that you had? I will try to help, but I wrote this code long time ago and it is not production quality, so please excuse any errors that you get.
from kaggle-dstl.
hi,
1. I'm using raw data.Run according to the example you gave (below).
Making a submission
Train a CNN (choose number of epochs and other hyper-params running without --all):
$ ./train.py checkpoint-folder --all --hps dice_loss=10,n_epochs=70
2. There was an error(below).
Traceback (most recent call last):
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "./train.py", line 306, in gen_batch
torch.from_numpy(np.array(dist_outputs)))
RuntimeError: the given numpy array has zero-sized dimensions. Zero-sized dimensions are not supported in PyTorch
3. Error location is located at train.py(Upside down count second lines are 306 lines)
def train_on_images(self, train_images: List[Image],
subsample: int=1,
square_validation: bool=False,
no_mp: bool=False):
self.net.train()
b = self.hps.patch_border
s = self.hps.patch_inner
# Extra margin for rotation
m = int(np.ceil((np.sqrt(2) - 1) * (b + s / 2)))
mb = m + b # full margin
mean_area = np.mean(
[im.size[0] * im.size[1] for im in train_images])
n_batches = int(
mean_area / (s + b) / self.hps.batch_size / subsample / 2)
def gen_batch(_):
inputs, outputs, dist_outputs = [], [], []
for _ in range(self.hps.batch_size):
im, (x, y) = self.sample_im_xy(train_images, square_validation)
if random.random() < self.hps.oversample:
for _ in range(1000):
if im.mask[x: x + s, y: y + s].sum():
break
im, (x, y) = self.sample_im_xy(
train_images, square_validation)
patch = im.data[:, x - mb: x + s + mb, y - mb: y + s + mb]
mask = im.mask[:, x - m: x + s + m, y - m: y + s + m]
if self.hps.needs_dist:
dist_mask = im.dist_mask[:, x - m: x + s + m, y - m: y + s + m]
if self.hps.augment_flips:
if random.random() < 0.5:
patch = np.flip(patch, 1)
mask = np.flip(mask, 1)
if self.hps.needs_dist:
dist_mask = np.flip(dist_mask, 1)
if random.random() < 0.5:
patch = np.flip(patch, 2)
mask = np.flip(mask, 2)
if self.hps.needs_dist:
dist_mask = np.flip(dist_mask, 2)
if self.hps.augment_rotations:
assert self.hps.augment_rotations != 1 # old format
angle = (2 * random.random() - 1.) * self.hps.augment_rotations
patch = utils.rotated(patch, angle)
mask = utils.rotated(mask, angle)
if self.hps.needs_dist:
dist_mask = utils.rotated(dist_mask, angle)
if self.hps.augment_channels:
ch_shift = np.random.normal(
1, self.hps.augment_channels, patch.shape[0])
patch = patch * ch_shift[:, None, None]
inputs.append(patch[:, m: -m, m: -m].astype(np.float32))
outputs.append(mask[:, m: -m, m: -m].astype(np.float32))
if self.hps.needs_dist:
dist_outputs.append(
dist_mask[:, m: -m, m: -m].astype(np.float32))
return (torch.from_numpy(np.array(inputs)),
torch.from_numpy(np.array(outputs)),
torch.from_numpy(np.array(dist_outputs)))
self._train_on_feeds(gen_batch, n_batches, no_mp=no_mp)
from kaggle-dstl.
I see - this is indeed the same error as #2 (I noticed your message in this issue only here). Unfortunately, I don't have any other ideas besides missing input data.
Do you mind if I close this issue as a duplicate of #2?
from kaggle-dstl.
Is it missing data, or lack of data ?
from kaggle-dstl.
Training script needs training data which was provided for this competition. This repo does not contain this data.
from kaggle-dstl.
however i already download this data.
url: [https://www.kaggle.com/c/dstl-satellite-imagery-feature-detection/data]
grid_sizes.csv.zip
sample_submission.csv.zip
sixteen_band.zip
three_band.zip
train_geojson_v3.zip
train_wkt_v4.csv.zip
from kaggle-dstl.
This data also needs to be unpacked, for an idea of the paths see here https://github.com/lopuhin/kaggle-dstl/blob/master/utils.py#L47-L53
In general, this repo is not supported, this is a code dump after the competition so you can check the general approach, but getting this to work will require either running this against your own data, or debugging issues such as the one you met.
from kaggle-dstl.
You're right, but I've unzipped it, and I hope you can “try catch"before open file or path. But your source code doesn't work,I'll have to debug. Thank you very much.
from kaggle-dstl.
set args "dist_loss=10,n_epochs=70" , the project will run.
from kaggle-dstl.
Related Issues (10)
- Missing file on run train_wkt_v4.csv HOT 7
- Extract Building Footprint from Satellite Images
- Running the repo on the competition data
- Your program doesn't work. HOT 5
- Running error HOT 6
- A little question HOT 1
- I found 2 problem that lead to the source code can not work HOT 1
- What ‘s your prediction time for one image?
- Typo on README??? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kaggle-dstl.