Code Monkey home page Code Monkey logo

Comments (1)

csxmli2016 avatar csxmli2016 commented on September 18, 2024

文章中说“The text background is obtained from DIV2K [1] and Flick2K [59] datasets, in which each image is randomly cropped and upsampled to ×4 ∼16 to synthesize the complex background”,代码中实现的似乎与文章不符,代码中的逻辑也不大理解,可以麻烦稍微介绍一下代码逻辑吗~

   for split in SplitNames:
        fis = os.listdir(osp.join(TestImgPath, split))
        for fi in fis:
            KeyLists = os.listdir(osp.join(TestImgPath, split, fi))
            for key in KeyLists:
                ImgLists = os.listdir(osp.join(TestImgPath, split, fi, key))
                for ImgName in ImgLists:
                    ImgPath = osp.join(TestImgPath, split, fi, key, ImgName)
                    A = Image.open(ImgPath).convert('RGB')
                    w,h = A.size
                    print([split,fi,key,ImgName])
                    for ss in ScaleLists: 
                        new_w = w*ss//10
                        new_h = h*ss//10
                        if ss < ScaleLists[0]:
                            A = A.resize((new_w, new_h), Image.LANCZOS)

                        HowmanyEach = min(new_w//CropSize, new_h//CropSize) * 2 * 2
                        for j in range(HowmanyEach):
                            _, Crop, V, M = GetHighPatch(A, CropSize)
                            total = total + 1
                            SaveName = '{}_{}_{}_{}_{:05d}_{:02d}.png'.format(split, fi, key, ImgName[:-4],j,ss)
                            Crop.save(os.path.join(SavePath, SaveName))

crop_DF2K.py 这个文件只是将DF2K图像裁剪成图像块,对应的是‘The text background is obtained from DIV2K [1] and Flick2K [59] datasets, in which each image is randomly cropped’,
后面的’upsampled to ×4 ∼16 to synthesize the complex background‘ 是在读取训练数据时用到的,参考

def get_background_patch(self, gt_path):

from marconet.

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.