Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you share the training script? #30

Closed
Coderx7 opened this issue Nov 7, 2020 · 4 comments
Closed

Can you share the training script? #30

Coderx7 opened this issue Nov 7, 2020 · 4 comments

Comments

@Coderx7
Copy link

Coderx7 commented Nov 7, 2020

Hi, Thans a lot for sharing your work. really appreciate it.
Can you also share the training script that was used to achieve your results?
Its much appreciated.

@Coderx7
Copy link
Author

Coderx7 commented Nov 8, 2020

@davidzhangyuanhan I'd appreciate any feedback on this.

@ZhangYuanhan-AI
Copy link
Owner

Because of the rule of the company, I can't share the training script recently. But I can explain any training details here if you ask.

@hamhanry
Copy link

Hi @davidzhangyuanhan ,
thanks for your sharing research to the community.
could you share more the parameter you use during training or any undescribed in the paper?
however, the training results i tried is still cant compared to the result in your paper.
as for now, i found still so many False Positives.
Thanks

@ZhangYuanhan-AI
Copy link
Owner

ZhangYuanhan-AI commented Jun 2, 2022

Here, we share part of our data loading pipeline code:

%%%%Transform%%%%%
        self.transform_ColorJitter= transforms.Compose([
            transforms.Resize((self.new_width, self.new_height)),
            transforms.ColorJitter(saturation = 1),
            transforms.ToTensor(),
            transforms.Normalize(mean = (0.5, 0.5, 0.5), std = (0.5, 0.5, 0.5))
           ])

  
def __getitem__(self, idx):
        filename =  self.metas[idx][0]
        cls = self.metas[idx][1]

        img = cv2_loader(filename)
        real_h,real_w,c = img.shape
        
        #Load bounding box
        assert os.path.exists(filename[:-4] + '_BB.txt'),'path not exists' + filename
   
        with open(filename[:-4] + '_BB.txt','r') as f:
            material = f.readline()
        try:
            x,y,w,h,score = material.strip().split(' ')
        except:
            print('[Rank' + str(self.rank) + ']' + filename)

        try:
            w = int(float(w))
            h = int(float(h))
            x = int(float(x))
            y = int(float(y))
            w = int(w*(real_w / 224))
            h = int(h*(real_h / 224))
            x = int(x*(real_w / 224))
            y = int(y*(real_h / 224))
            
            #Crop image
            if y < 0:
                y1 = 0
            else:
                y1 = y

            if x < 0:
                x1 = 0
            else:
                x1 = x

            if y1 + h > real_h:
                y2 = real_h
            else:
                y2 = y + h

            if x1 + w > real_w:
                x2 = real_w
            else:
                x2 =  x + w
            img = img[y1:y2,x1:x2,:]
                

        assert img.shape[0] != 0 and img.shape[1] != 0,'img_path:' + filename + ' idx:' + str(idx)
        img = Image.fromarray(cv2.cvtColor(img,cv2.COLOR_BGR2RGB)) 
        img = self.transform_ColorJitter(img)
        assert img.shape[0] == 3,filename 
        return img, cls   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants