xuebinqin / U-2-Net

The code for our newly accepted paper in Pattern Recognition 2020: "U^2-Net: Going Deeper with Nested U-Structure for Salient Object Detection."
Apache License 2.0
8.66k stars 1.49k forks source link

The problem of saving pth file(Try to train a custom new data model) #219

Open GINKOX opened 3 years ago

GINKOX commented 3 years ago

First of all, thank you for your work

I try to use u2net_train.py in this project for training. I put a picture in the train_data folder im_aug and gt_aug for simple test training, but the final saved ".pth" file is 168m, which looks like it contains the pre training u2net.pth. How can I modify it so that I can save the new data model without pre training u2net.pth's data ps: I didn't change the code in u2net_train.py, And I don't see the code in this file to load the pre training u2net.pth look forward to your reply, thx

xuebinqin commented 3 years ago

Sorry, I am not quite sure if I understand your question. Even with one image, 168 M .pth (vary a little bit in different OS) should be correct and the model size won't change w.r.t the number of the input image.

On Wed, Jun 16, 2021 at 8:35 PM GINKOX @.***> wrote:

First of all, thank you for your work

I try to use u2net_train.py in this project for training. I put a picture in the train_data folder im_aug and gt_aug for simple test training, but the final saved ".pth" file is 168m, which looks like it contains the pre training u2net.pth. How can I modify it so that I can save the new data model without pre training u2net.pth's data ps: I didn't change the code in u2net_train.py, And I don't see the code in this file to load the pre training u2net.pth look forward to your reply, thx

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xuebinqin/U-2-Net/issues/219, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSGORJZGTWXQG6NYJMEXK3TTDHENANCNFSM46Z2KU3A .

-- Xuebin Qin PhD Department of Computing Science University of Alberta, Edmonton, AB, Canada Homepage:https://webdocs.cs.ualberta.ca/~xuebin/

GINKOX commented 3 years ago

Sorry, I am not quite sure if I understand your question. Even with one image, 168 M .pth (vary a little bit in different OS) should be correct and the model size won't change w.r.t the number of the input image. On Wed, Jun 16, 2021 at 8:35 PM GINKOX @.***> wrote: First of all, thank you for your work I try to use u2net_train.py in this project for training. I put a picture in the train_data folder im_aug and gt_aug for simple test training, but the final saved ".pth" file is 168m, which looks like it contains the pre training u2net.pth. How can I modify it so that I can save the new data model without pre training u2net.pth's data ps: I didn't change the code in u2net_train.py, And I don't see the code in this file to load the pre training u2net.pth look forward to your reply, thx — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#219>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSGORJZGTWXQG6NYJMEXK3TTDHENANCNFSM46Z2KU3A . -- Xuebin Qin PhD Department of Computing Science University of Alberta, Edmonton, AB, Canada Homepage:https://webdocs.cs.ualberta.ca/~xuebin/

20210616102626 Sorry, I forgot to say that I use the windows platform. I have two doubts. Please take a look at my screenshot. In the red box is the pre training model file downloaded from Google driver. The others are obtained by running u2net_train.py training. I have two doubts:

  1. Why do I get such a big data model by training only one picture

  2. The data file from the training is just a little bit larger than the pre training model file, so I wonder if the pre training model data is loaded in the u2net_train.py code.

I hope my question has been described clearly Thanks again

xuebinqin commented 3 years ago
  1. Why do I get such a big data model by training only one picture RE: THe model size is currently fixed regardless the number of the training images. It is not a NAS model.

  2. The data file from the training is just a little bit larger than the pre training model file, so I wonder if the pre training model data is loaded in the u2net_train.py code. RE: No. The .pth model is used for the testing code. If you want to finetuning the model based on your data, you can manually restore it in the training code.

On Thu, Jun 17, 2021 at 10:16 AM GINKOX @.***> wrote:

Sorry, I am not quite sure if I understand your question. Even with one image, 168 M .pth (vary a little bit in different OS) should be correct and the model size won't change w.r.t the number of the input image. … <#m5769413758893011590> On Wed, Jun 16, 2021 at 8:35 PM GINKOX @.***> wrote: First of all, thank you for your work I try to use u2net_train.py in this project for training. I put a picture in the train_data folder im_aug and gt_aug for simple test training, but the final saved ".pth" file is 168m, which looks like it contains the pre training u2net.pth. How can I modify it so that I can save the new data model without pre training u2net.pth's data ps: I didn't change the code in u2net_train.py, And I don't see the code in this file to load the pre training u2net.pth look forward to your reply, thx — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#219 https://github.com/xuebinqin/U-2-Net/issues/219>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSGORJZGTWXQG6NYJMEXK3TTDHENANCNFSM46Z2KU3A . -- Xuebin Qin PhD Department of Computing Science University of Alberta, Edmonton, AB, Canada Homepage:https://webdocs.cs.ualberta.ca/~xuebin/

[image: 20210616102626] https://user-images.githubusercontent.com/86012517/122341850-85a1dc00-cf76-11eb-9b80-c6003c5b3c55.png Sorry, I forgot to say that I use the windows platform. I have two doubts. Please take a look at my screenshot. In the red box is the pre training model file downloaded from Google driver. The others are obtained by running u2net_train.py training. I have two doubts:

1.

Why do I get such a big data model by training only one picture 2.

The data file from the training is just a little bit larger than the pre training model file, so I wonder if the pre training model data is loaded in the u2net_train.py code.

I hope my question has been described clearly Thanks again

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xuebinqin/U-2-Net/issues/219#issuecomment-862959472, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADSGORLJSNI3246YDTT6GBTTTGHLRANCNFSM46Z2KU3A .

-- Xuebin Qin PhD Department of Computing Science University of Alberta, Edmonton, AB, Canada Homepage:https://webdocs.cs.ualberta.ca/~xuebin/