Giter Site home page Giter Site logo

ml-kurkkumopo-training's People

Contributors

jakousa avatar sasumaki avatar suruaku avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

rochet2 ipcagr1d

ml-kurkkumopo-training's Issues

Should error early when folder doesnt exist

def get_images(prefix, url):
imgs = []
uri = ""
try:
img = imageio.imread(url)
img = imresize(img, (128, 128))
identifier = str(uuid.uuid4())
uri = "imgs/" + prefix + identifier + ".jpg"
imageio.imwrite(uri, img)
except:
return
return uri

The exception catching is too broad. Any filesystem exception is also hidden, which means that in the exercises if someone has configured the volumes wrongly he will get confusing errors that point inside the train function.

kurkkufront_1  | INFO: Accepting connections at http://localhost:3000
kurkkutrain_1  | Using TensorFlow backend.
kurkkutrain_1  | gathering cucumbers...
kurkkutrain_1  | gathering mopeds...
kurkkutrain_1  | Traceback (most recent call last):
kurkkutrain_1  |   File "train.py", line 84, in <module>
kurkkutrain_1  |     train(X, y)
kurkkutrain_1  |   File "train.py", line 41, in train
kurkkutrain_1  |     model.fit(x=X_train, y=y_train, batch_size=128, epochs=5, verbose=1)
kurkkutrain_1  |   File "/usr/local/lib/python3.6/site-packages/keras/engine/training.py", line 952, in fit
kurkkutrain_1  |     batch_size=batch_size)
kurkkutrain_1  |   File "/usr/local/lib/python3.6/site-packages/keras/engine/training.py", line 751, in _standardize_user_data
kurkkutrain_1  |     exception_prefix='input')
kurkkutrain_1  |   File "/usr/local/lib/python3.6/site-packages/keras/engine/training_utils.py", line 128, in standardize_input_data
kurkkutrain_1  |     'with shape ' + str(data_shape))
kurkkutrain_1  | ValueError: Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (0, 1)
24_kurkkutrain_1 exited with code 1

After a bit of debugging and removing the try catch I got the following error message. Seems that it could be worth catching at least FileNotFoundError and then raise to halt the program to show an error to user immediately when we know that the training will fail because of missing files/folders. Possibly some other exceptions would be good to not catch too.

kurkkufront_1  | INFO: Accepting connections at http://localhost:3000
kurkkutrain_1  | Using TensorFlow backend.
kurkkutrain_1  | gathering cucumbers...
kurkkutrain_1  | multiprocessing.pool.RemoteTraceback: 
kurkkutrain_1  | """
kurkkutrain_1  | Traceback (most recent call last):
kurkkutrain_1  |   File "/usr/local/lib/python3.6/multiprocessing/pool.py", line 119, in worker
kurkkutrain_1  |     result = (True, func(*args, **kwds))
kurkkutrain_1  |   File "/usr/local/lib/python3.6/multiprocessing/pool.py", line 44, in mapstar
kurkkutrain_1  |     return list(map(*args))
kurkkutrain_1  |   File "train.py", line 53, in get_images
kurkkutrain_1  |     imageio.imwrite(uri, img)
kurkkutrain_1  |   File "/usr/local/lib/python3.6/site-packages/imageio/core/functions.py", line 258, in imwrite
kurkkutrain_1  |     writer = get_writer(uri, format, "i", **kwargs)
kurkkutrain_1  |   File "/usr/local/lib/python3.6/site-packages/imageio/core/functions.py", line 174, in get_writer
kurkkutrain_1  |     request = Request(uri, "w" + mode, **kwargs)
kurkkutrain_1  |   File "/usr/local/lib/python3.6/site-packages/imageio/core/request.py", line 125, in __init__
kurkkutrain_1  |     self._parse_uri(uri)
kurkkutrain_1  |   File "/usr/local/lib/python3.6/site-packages/imageio/core/request.py", line 278, in _parse_uri
kurkkutrain_1  |     raise FileNotFoundError("The directory %r does not exist" % dn)
kurkkutrain_1  | FileNotFoundError: The directory '/src/imgs' does not exist
kurkkutrain_1  | """
kurkkutrain_1  | 
kurkkutrain_1  | The above exception was the direct cause of the following exception:
kurkkutrain_1  | 
kurkkutrain_1  | Traceback (most recent call last):
kurkkutrain_1  |   File "train.py", line 69, in <module>
kurkkutrain_1  |     cucumber_imgs = p.map(func, cucumbers["url"])
kurkkutrain_1  |   File "/usr/local/lib/python3.6/multiprocessing/pool.py", line 288, in map
kurkkutrain_1  |     return self._map_async(func, iterable, mapstar, chunksize).get()
kurkkutrain_1  |   File "/usr/local/lib/python3.6/multiprocessing/pool.py", line 670, in get
kurkkutrain_1  |     raise self._value
kurkkutrain_1  | FileNotFoundError: The directory '/src/imgs' does not exist
24_kurkkutrain_1 exited with code 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.