Giter VIP home page Giter VIP logo

create-a-hdf5-data-set-for-deep-learning's People

Contributors

feiyuhuahuo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

create-a-hdf5-data-set-for-deep-learning's Issues

error in function resize

hdf5_path='/Users/matioszenebegezahegn/Desktop/SynthText-master/data/image.hdf5'
image_directory='/Users/matioszenebegezahegn/Desktop/SynthText-master/data/bg_img/*.jpg'

addrs = glob.glob(image_directory)
images_shape = (len(addrs), 128, 128, 3)

open a hdf5 file and create earrays

f = h5py.File(hdf5_path, mode='w')

PIL.Image: the pixels range is 0-255,dtype is uint.

matplotlib: the pixels range is 0-1,dtype is float.

f.create_dataset("image", images_shape, np.uint8)

loop over train paths

for i in range(len(addrs)):
addr = addrs[i]
img = cv2.imread(addr)
img = cv2.resize(img, (128, 128), interpolation=cv2.INTER_CUBIC)# resize to (128,128)
#img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # cv2 load images as BGR, convert it to RGB
f["image"][i, ...] = img[None]
f.close()


error Traceback (most recent call last)
in ()
15 addr = addrs[i]
16 img = cv2.imread(addr)
---> 17 img = cv2.resize(img, (128, 128), interpolation=cv2.INTER_CUBIC)# resize to (128,128)
18 #img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # cv2 load images as BGR, convert it to RGB
19 f["image"][i, ...] = img[None]

error: /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/imgwarp.cpp:3483: error: (-215) ssize.width > 0 && ssize.height > 0 in function resize

why the error comes? any ideas pls.

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.