Skip to content

How to add my own images into dest.h5? #5

Closed

Description

@junboLiu

Hello ankush, I am having trouble creating my own data set. I want add images to dest.h5,but I didn't find the method. Can you provide the example?

Activity

  1. junboLiu commented on Nov 30, 2016

    @junboLiu
    Author

    I mean how to get the depth and segmentation information of image?

  2. ankush-me commented on Nov 30, 2016

    @ankush-me
    Owner

    Hi @junboLiu! You can use depth-from-single image ConvNets and popular segmentation methods like gPb-UCM or "Holistic Edge Detection".

  3. crazylyf commented on Jan 19, 2017

    @crazylyf

    There are an in-door and an out-door pre-trained model for FCRN depth predictions. Is there much difference between those models, and which one should I choose?

  4. cjnolet commented on Jan 19, 2017

    @cjnolet
  5. ankush-me commented on Jan 19, 2017

    @ankush-me
    Owner

    The indoor/ outdoor models are expected to perform better on images from their respective domains. However, this may not be too critical for synthetic text placement.

  6. crazylyf commented on Jan 20, 2017

    @crazylyf

    @cjnolet @ankush-me
    I see, thx~

  7. crazylyf commented on Jan 20, 2017

    @crazylyf

    Another question: the depth of images in dset.h5 file have two channels, while the depth predicted by FCRN has only one channel. Is there any additional preprocessing? Best!

  8. ankush-me commented on Jan 21, 2017

    @ankush-me
    Owner

    FCRN in our CVPR work does not predict depth.

    The two channels correspond to predictions by the depth-prediction models trained on outdoor and indoor datasets.

  9. oneOfThePeople commented on Jan 22, 2017

    @oneOfThePeople

    how you deal with the problem that each image have different size and the depth prediction and the segmentation network required fix size of input image?

  10. ankush-me commented on Jan 22, 2017

    @ankush-me
    Owner

    As far as I recall, there is a limit of 600px for the depth prediction network, (and no size limit at least for the gPb-UCM segmentation method). So I rescale down the image if it is bigger than 600 px; and then bring all the three things -- RGB, depth, segmentation -- to the same size (check here).

  11. oneOfThePeople commented on Jan 23, 2017

    @oneOfThePeople

    i see you resize to the depth image and not to the original one . why?
    thank alot for your patience

  12. crazylyf commented on Jan 23, 2017

    @crazylyf

    Hi @ankush-me
    What does the segmentation variables seg, area, and label mean? Does the seg and area refer to the superpixels of proposals and area of the bounding boxes of gPb-UCM? what is label?
    Thanks a lot!

  13. ankush-me commented on Jan 23, 2017

    @ankush-me
    Owner

    @oneOfThePeople : I did not want to interpolate the depth image.

    @crazylyf : "Seg" is a region labeling, where pixels in each segment have the same label. "Label" is just a vector of unique values in "seg". "Area" is the number of pixels in the each segment, where, the i-th "area" corresponds to the segment with the i-th "label".

  14. oneOfThePeople commented on Jan 23, 2017

    @oneOfThePeople

    ok thank alot

  15. CatherineYao commented on Apr 28, 2017

    @CatherineYao

    How to get the "seg" "label" and "area" from gPb-UCM (https://github.com/jponttuset/mcg) code that you advised. Thanks a lot. @ankush-me

  16. FuriousRococo commented on Aug 1, 2017

    @FuriousRococo

    Hello Ankush, I've been stuck in creating segmentation infomation of the images and I really need u help! I've managed to run u code in Windows system with Python 3.5 and OpenCV3, but I couldn't find a way to replace gPb-UCM? Is there any method written in python while feasible to run in Windows?

  17. ankush-me commented on Aug 1, 2017

    @ankush-me
    Owner

    I got segmentation information from gPb-UCM / MCG (as pointed above).
    You can use scikit-image (I haven't used this myself): http://scikit-image.org/docs/dev/auto_examples/segmentation/plot_segmentations.html

  18. 425183525 commented on Aug 31, 2018

    @425183525

    Hello Ankush,I have generated a .mat file, how do I turn a .mat file into a .h5 file?

  19. T43113452 commented on May 7, 2019

    @T43113452

    Sorry.I don't know that depth is translate persepctive.

  20. ahappycutedog commented on Dec 13, 2019

    @ahappycutedog

    Hello Ankush,I have generated a .mat file, how do I turn a .mat file into a .h5 file?

    你好 我想问下你生成这个mat文件是在ubuntu系统上吗 没有保错吗 我这边用ubuntu16.04 上的matlab2016 就出现了这个错误;
    WARNING: Database pascal2012 (folder JPEGImages) not found in /path/to/pascal2012/
    WARNING: Database SBD (folder images) not found in /path/to/SBD/
    WARNING: Database COCO (folder images) not found in /path/to/COCO/
    -- You can disable this warning in install.m --
    -- Successful installation of MCG. Enjoy! --
    Warning: The temporary variable im will be cleared at the beginning of each iteration of the parfor loop.
    Any value assigned to it before the loop will be lost. If im is used before it is assigned in the parfor loop, a runtime error will occur.
    See Parallel for Loops in MATLAB, "Temporary Variables".

    In run_ucm (line 22)
    Starting parallel pool (parpool) using the 'local' profile ... connected to 12 workers.
    1 of 3
    err
    2 of 3
    err
    3 of 3
    Analyzing and transferring files to the workers ...done.
    1 of 3
    err
    2 of 3
    err
    3 of 3
    Error using im2ucm (line 39)
    An UndefinedFunction error was thrown on the workers for 'loadvar'. This might be because the file containing 'loadvar' is not accessible on the workers. Use addAttachedFiles(pool, files) to specify the
    required files to be attached. See the documentation for 'parallel.Pool/addAttachedFiles' for more details.

    Error in run_ucm (line 22)
    parfor i = 1:numel(imname)

    Caused by:
    Undefined function 'loadvar' for input arguments of type 'char'.

    请问这个知道怎么解决吗

  21. etsegenet2020 commented on Oct 25, 2020

    @etsegenet2020

    hi ... i use this code for my project but i get error like this
    Traceback (most recent call last):
    File "/home/molaligntamiru/Documents/SynthText/synthgen.py", line 658, in render_text
    txt_render_res = self.place_text(img,place_masks[ireg],
    File "/home/molaligntamiru/Documents/SynthText/synthgen.py", line 500, in place_text
    render_res = self.text_renderer.render_sample(font,collision_mask)
    File "/home/molaligntamiru/Documents/SynthText/text_utils.py", line 366, in render_sample
    text_type = sample_weighted(self.p_text)
    File "/home/molaligntamiru/Documents/SynthText/text_utils.py", line 22, in sample_weighted
    return p_dict[np.random.choice(ps,p=ps)]
    File "mtrand.pyx", line 892, in numpy.random.mtrand.RandomState.choice
    ValueError: a must be 1-dimensional or an integer

    what can i do?

  22. Lane689 commented on Jan 28, 2022

    @Lane689

    Hi guys, @crazylyf , @cjnolet

    How did you extract depth images from h5 file, or how are you upload depth images into synthtext script?

    Here is my code:

    import h5py
    import numpy as np
    import cv2
    
    save_dir = 'C:/Users.../depth_imgs'
    
    with h5py.File('depth.h5', 'r') as hf:
        image_ds = hf
        for imagename in image_ds.keys():
            IMAGE_arr = image_ds[imagename][()]
            cv2.imwrite(f"{save_dir}/{imagename}", IMAGE_arr)
            cv2.waitKey(1000)
            cv2.destroyAllWindows()
    

    But when I run this code it shows me this error:

    image

    Then I try print(IMAGE_arr.dtype, IMAGE_arr.shape) and this gives me a results:

    float32 (2, 600, 400)
    float32 (2, 600, 493)
    float32 (2, 600, 284)

    The first one "2" here refers to two different depth estimates by two different neural networks (one trained on mostly indoor images, and the other on outdoor images).
    Because of that I can't imwrite( ) images into a folder while images from seg.h5 (segmentation images) I successfully saved in a folder.
    Opencv's imwrite expects (height, width, channels).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions