I’m building a training data set.  While it’s running it shows this:

image.png725×618 5.01 KB

What not hold it to one line and show the progress as it goes?  Did I code something wrong?  Below is my training class:

class roof_dataset():
claims = ‘D:\CIS inspection images 0318\train\roof\claims’
no_claims = ‘D:\CIS inspection images 0318\train\roof\no_claims’
LABELS  = {claims: 1, no_claims: 0}
training_data = []
claim_count = 0
no_claim_count = 0


def make_training_data(self):
    for label in self.LABELS:
        print(label)
        for f in tqdm(os.listdir(label)):
            if "JPG" in f:
                try:
                    path = os.path.join(label, f)
                    img = Image.open(path)
                    pic = train_transform(img)
                    self.training_data.append([pic, np.eye(2)[self.LABELS[label]]])
                    
                    if label == self.claims:
                        self.claim_count += 1
                    elif label == self.no_claims:
                        self.no_claim_count += 1

                except Exception as e:
                    pass
                    #print(label, f, str(e))
                    
    np.random.shuffle(self.training_data)
    np.save("D:\\CIS inspection images 0318\\self_build\\training_data.npy", self.training_data)
    print('claims:',self.claim_count)
    print('no_claims:',self.no_claim_count)