Git Product home page Git Product logo

Comments (2)

deartonym avatar deartonym commented on August 15, 2024

I have exactly the same error and am trying to figure out as well.

from pytorch-fcn.

Deepayan137 avatar Deepayan137 commented on August 15, 2024

I resolved this issue by padding my images and my labels so that they become of uniform dimension.
I took the image with maximum width and then padded all other images by adding 1 on both left and right side.

class zeroPadding(object):
	def __call__(self, sample):
		image, truth = sample['image'], sample['ground truth']
		image_height = image.shape[0]
		image_width = image.shape[1]
		
		#height_diff = max_height - image_height
		width_diff  = max_width - image_width
		
		left=width_diff//2
		right=width_diff - left
		#print(left, right)
		top = 0
		bottom = 0
		constant = cv2.copyMakeBorder(image,0,0,left,right, cv2.BORDER_CONSTANT, value= 1)
		return {'image': constant,
				'ground truth': truth}

for Lables I ttok the longest sequence among all the labels.



	
	data =torch.zeros((lsequence))
	lensequence = []
	
	for i, letter in enumerate(sequence):
		try:
			
			data[i] = lettertoindex(letter)
			
			#su = su|data[i,:]
		except:
			print(i,letter)
	
	return (data.int())

from pytorch-fcn.

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.