Giter VIP home page Giter VIP logo

Comments (4)

PSZehnder avatar PSZehnder commented on May 16, 2024

I am also running into this issue. Any help from the devs or people who have successfully trained on their own data sets would be much appreciated!

from mmagic.

PSZehnder avatar PSZehnder commented on May 16, 2024

@ienko I have found a solution. The issue was in codes/data/LQGT_dataset.py in the random crop step (around line 110). I rewrote the random crop algorithm like this:

        gt_h = random.randint(0, max(0, gH - GT_size))
        gt_w = random.randint(0, max(0, gW - GT_size))
        img_GT = img_GT[gt_h:gt_h + GT_size, gt_w:gt_w + GT_size, :]

        LQ_size = GT_size // scale
        lq_h = gt_h // scale
        lq_w = gt_w // scale
        img_LQ = img_LQ[lq_h:lq_h + LQ_size, lq_w:lq_w + LQ_size, :]

and that fixed the error

from mmagic.

ienko avatar ienko commented on May 16, 2024

@PSZehnder great, thanks a lot.

I also managed to solve it in a similar way, with writing another code for preprocessing the dataset I had (needed 4:3 with specific resolutions).

    imgScale = H/height
    newX, newY = oriimg.shape[1]*imgScale, oriimg.shape[0]*imgScale
    newimg = cv2.resize(oriimg, (int(newX), int(H)))
    
    newWidth = int(W)
    newHeight = int(H)
    xBegin = (int(newX) - int(newWidth))/2
    xEnd = int(xBegin) + int(newWidth)
    cropped = newimg[0:1920, int(xBegin):int(xEnd)]

For some reason, it still doesn't work for all the batch sizes, but guess that's implied by network architecture.

from mmagic.

pratyushlohumi26 avatar pratyushlohumi26 commented on May 16, 2024

The model arch is such that it requires: (128,128,3) as GT (X) and (32,32,3) as LR (Y).

Keeping these two dimensions in mind, I was able to create my own dataset, then create it's corresponding lmdb files using the ./codes/data_scripts/create_lmdb.py and also validate the lmdb files created using the ./code/data_scrpits/test_dataloader.py file

Make sure that you have the correct paths present in the ./option/train/train_model.yaml file before starting the training. I hope if you adhere to these images dimensions you'll be able to fit a decent batch size depending upon your GPU memory available and start the training easily on the custom dataset.

from mmagic.

Related Issues (20)

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.