Git Product home page Git Product logo

Comments (2)

ZouaghiHoussem avatar ZouaghiHoussem commented on July 27, 2024

from what i understood, they hardcoded the name GTA in their scripts

from photorealismenhancement.

czero69 avatar czero69 commented on July 27, 2024

Hey, alongside replacing with the _load_img and applying torch.from_numpy(), I also needed to permute channels accordingly, and in the end make cpu detach in matching/feature_based/sample_matches.py. Below is my code:

for x in range(min(25,src_id.shape[0])):
			i = int(rd[x])
			print(f'\tloading sample {i}...')
			#img, _ = src_dataset.get_by_path(src_paths[int(src_id[i])])
			img = torch.from_numpy(src_dataset._load_img(src_paths[int(src_id[i])])).permute(2,0,1)
			print("img size", img.size())
			r0,r1,c0,c1 = src_coords[int(src_id[i])]
			a = img[:,r0:r1,c0:c1].unsqueeze(0)
			#img, _ = dst_dataset.get_by_path(dst_paths[int(dst_id[int(src_id[i]), int(knn[i])])])
			img = torch.from_numpy(dst_dataset._load_img(dst_paths[int(dst_id[int(src_id[i]), int(knn[i])])])).permute(2,0,1)
			r0,r1,c0,c1 = dst_coords[int(dst_id[int(src_id[i]), int(knn[i])])]
			b = img[:,r0:r1,c0:c1].unsqueeze(0)
			crops.append(a)
			crops.append(b)
			pass

		if len(crops) > 0:
			grid = make_grid(torch.cat(crops, 0), nrow=2)
			some_arr = (255.0*grid.permute(1,2,0).cpu().detach().numpy()).astype(np.uint8)
			print("some_arr shp:", some_arr.shape)
			imwrite(f'knn_{t}.jpg', some_arr)
			pass
		pass

from photorealismenhancement.

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.