varunagrawal / tiny-faces-pytorch

Finding Tiny Faces in PyTorch
MIT License
164 stars 44 forks source link

Could you share the resulting picture? #4

Closed SkyfengBiuBiu closed 4 years ago

SkyfengBiuBiu commented 4 years ago

Hello, At first, thank you for your implement. There are still some bugs which I hope you could fix for better project.

  1. In the "WIDERFace" class, the load function would cause an error while reading the the pictures without bounding boxes. It would be fixed if it is changed to :

            bboxes = np.empty((n, 10))
    
            if n!=0:
                for b in range(n):
                    bboxes[b, :] = [abs(float(x))
                                for x in lines[idx].strip().split()]
                    idx += 1
            else:
                idx += 1
  2. Then the PyTorch version in "requirement.txt" should be 0.4.1.

  3. The run function in "evaluate.py" has the debug option. In this place, you forgot unnormalize the image. Changing to : if debug: mean = torch.as_tensor([0.485, 0.456, 0.406], dtype=torch.float32, device=img.device) std = torch.as_tensor([0.229, 0.224, 0.225], dtype=torch.float32, device=img.device)

        img=(img[0]).permute((1, 2, 0))
        img=std*img+mean
        img=np.clip(img.numpy(),0,1)
        im = Image.fromarray((img*255).astype('uint8'), 'RGB')
        visualize.visualize_bboxes(im, dets)

it would fix the wired picture.

What's more? After applying the "visualize.visualize_bboxes" , the resulting picture (from test folder) does not satisfy me as the original Matlab model. By using the default parameters as you gave and training model with 50 epochs, the results are presented as the following figures. 0 49843369913251623 0 26791034629033217 0 12144445914391433 0 9841258305625651 0 8950883280463936 0 8476592584406182 0 6770404203657887 0 5918913651406368 0 3623791789569477

(prob_thresh=0.6 nms_thresh=0.1) Could you provide your per-trained model and share us the resulting pictures? Thank you very much!! For better project :+1: :+1:

varunagrawal commented 4 years ago

@SkyfengBiuBiu thank you for the feedback.

  1. If you have n=0 in the dataset, the next line should be blank, and not have any values, else the dataset is incorrect. I tested the use case you defined and the code works fine, especially since the loop will not execute if n is 0.

  2. I have updated the requirements.txt. Thank you for that.

  3. That debug code was actually for my convenience to debug some weird behavior. I have removed it in the latest commits and updated the code. If you run the current master branch, you should get far better results than what you have been getting. There was a bug where I was normalizing the image twice, but I have fixed that and things work great (I am able to get close to the same results as the original implementation from the paper author).

Queequeg92 commented 4 years ago

@varunagrawal Hi, thanks for your good work! If you have no bounding box in an image, the next line is blank or all zeros in wider face ground-truth files. You have to delete all zeros cases manually, or you will get an error.

varunagrawal commented 4 years ago

I haven't done so in my dataloaders and both train and validation run fine. I am not sure why you would get an error. Can you please provide more details? Things like error traces, line numbers in the data files etc?

varunagrawal commented 4 years ago

Any updates?

hamzakhalil798 commented 1 year ago

@SkyfengBiuBiu can you kindly share the visualization script for an external picture or a picture from the test dataset?

And Did you find or trained a better model if yes please share