Become a leader in the IoT community!

Join our community of embedded and IoT practitioners to contribute experience, learn new skills and collaborate with other developers with complementary skillsets.

Step 1 of 5

CREATE YOUR PROFILE *Required

OR
Step 2 of 5

WHAT BRINGS YOU TO DEVHEADS? *Choose 1 or more

Connect & collaborate 🀝with other tech professionals
Learn & Grow πŸ“š
Contribute Experience & Expertise πŸ”§
Step 3 of 5

WHAT'S YOUR INTEREST OR EXPERTISE? *Choose 1 or more

Hardware Design πŸ’‘
Embedded Software πŸ’»
Edge Networking ⚑
Step 4 of 5

Personalize your profile

Step 5 of 5

Read & agree to our COMMUNITY RULES

  1. We want this server to be a welcoming space! Treat everyone with respect. Absolutely no harassment, witch hunting, sexism, racism, or hate speech will be tolerated.
  2. If you see something against the rules or something that makes you feel unsafe, let staff know by messaging @admin in the "support-tickets" tab in the Live DevChat menu.
  3. No age-restricted, obscene or NSFW content. This includes text, images, or links featuring nudity, sex, hard violence, or other graphically disturbing content.
  4. No spam. This includes DMing fellow members.
  5. You must be over the age of 18 years old to participate in our community.
  6. You agree to our Terms of Service (https://www.devheads.io/terms-of-service/) and Privacy Policy (https://www.devheads.io/privacy-policy)
By clicking "Finish", you have read and agreed to the our Terms of Service and Privacy Policy.

Using Transfer Learning with Pretrained Models

@wafa_ath hii, i wanna ask you , so my teacher told me to use tranfer learning and train my dataset with a pretrained model is that possible ? i used to use the pretrained model as it is…

  1. wafa_ath#0000

    Yes it’s possible

  2. wafa_ath#0000

    Actually it’s just extra steps with the pretrained model

  3. wafa_ath#0000

    So he is giving up the unserpervised learning method? @pieweii

  4. pieweii#0000

    let me explain for u qhat happened exactly this might be sooo long but:
    i used only transfer learning at the beginning with resnet50
    the result was good but sometimes it messes up with color
    so i made a color extractor and it uses color algorithm
    and i used a pretrained model (resnet) for extracting features other than color (i also converted images to gray scale before this step to just focus on features beside color)
    every feature extractor produces a linkage matrix that contains distances
    i combined both matrixes and i with adjusting weights i got a final combined matrix that i used later with clustering algorithm such as hierarchical

  5. pieweii#0000

    that worked perfectly honestly

  6. pieweii#0000

    yesterday i went to teacher he told me pretrained models are much better than making model from scratch because they maintain weights (like freezing some layers) he told me why dont u train a pretrained on your dataset (i have 529 unlabled img in dataset)

  7. pieweii#0000

    soo before yesterday someone ik in ml suggested me and said why dont u do your own model instead of using pretrained model since u have a large dataset of images sooo, i made my own model with pytorch and trained it and yeh the result was good

  8. pieweii#0000

    at the end i will use it as feature extractor but i need the model first

  9. pieweii#0000

    im kinda messed up i couldn’t ask the teacher how can i train a pretrained model on my dataset i felt i will look st_upid maybe, i went back home i searched it i found something callled fine tuning

  10. pieweii#0000

    my brain is gonna explode someday

  11. wafa_ath#0000

    The pretrained model are much better

  12. pieweii#0000

    and now he gave me time untill tomorrow to finish everything about ai and rapport ai part

  13. wafa_ath#0000

    Well your teacher is right

  14. pieweii#0000

    yeh i though so too

  15. pieweii#0000

    but how to adapt that with my dataset

  16. pieweii#0000

    training dataset*

  17. wafa_ath#0000

    Just load the model without the final layer output layer

  18. wafa_ath#0000

    So u told me you you worked with renset50,

  19. wafa_ath#0000

    In your case (type of fabri for example

  20. wafa_ath#0000

    Then add your own classification head

  21. wafa_ath#0000

    You can reuse 90% of your work

  22. wafa_ath#0000

    Since you are already familiar with that and you done it

  23. wafa_ath#0000

    Only the final part

  24. pieweii#0000

    to combine witu the color extractor

  25. pieweii#0000

    but i cant use on features extraction only if its trained on my data

  26. pieweii#0000

    the thing is im planning to use as feature extractor

  27. pieweii#0000

    right?

  28. wafa_ath#0000

    No, you can

  29. pieweii#0000

    then if i use as feature extractor only .. what i will do with the dataset i collected … it feels like wasted energy

  30. pieweii#0000

    should i just throw it away

  31. wafa_ath#0000

    You used resnet50 , extract the feature form it

  32. pieweii#0000

    i have a code that i have done like this i will show u

  33. pieweii#0000

    like for testing?

  34. wafa_ath#0000

    No

  35. pieweii#0000

    here i used it as feature extractor

  36. wafa_ath#0000

    Like train a layer with your own data , it’s called fine tuning

  37. wafa_ath#0000

    No don’t worry about it
    So what am saying is to use the rensnet50 (that the pretrained model) , use it to extract the feature from the fabric, that is the transfer learning

  38. wafa_ath#0000

    to make it better and to get used of your dataset and make your model better and personalized do the fine tuning

  39. pieweii#0000

    i will try that right now

  40. pieweii#0000

    ah im sorry im making u explain so much, i guess im not understand the whole phenomenon πŸ™‡πŸ»β€β™€οΈ so you are saying i gotta use transfer learning and then fine tune it with my datat then use it as fearure extractor?

  41. pieweii#0000

    ofc, i will be whole day working and updating u ✨️

  42. wafa_ath#0000

    Let me updated 😁

  43. pieweii#0000

    dont get tired of me πŸ₯²

  44. wafa_ath#0000

    i won’t it my pleasure

  45. pieweii#0000

    i will send u file and execution

  46. pieweii#0000

    i user llm to make code

  47. pieweii#0000

    but i understand nthg from it i will read it carefully later and explain line by line i was in hurry

  48. pieweii#0000
  49. pieweii#0000

    here

  50. wafa_ath#0000

    batch them using a tf.data.Dataset or at least group them manually

  51. pieweii#0000

    this is a big m_ess that i have no idea what it is but it worked.. when i tried that feature extractor

  52. wafa_ath#0000

    batch_size=1 , that would take forever

  53. wafa_ath#0000

    also Too many clusters (66) You need thousands of images or it will give bad clusters.

  54. pieweii#0000

    oh

  55. wafa_ath#0000

    you only used 3 images right ?

  56. pieweii#0000

    528

  57. pieweii#0000

    it took 30 mins to run

  58. pieweii#0000

    i felt there is something wrong about it

  59. pieweii#0000

    and then when it was saved i used as feature extractor in my original code

  60. pieweii#0000

    528 contain 66 clusters

  61. wafa_ath#0000

    aa never mind , i get confuse with somthing else

  62. pieweii#0000

    ah should i prganize the dataset?

  63. pieweii#0000

    organise

  64. pieweii#0000

    oh its alright

  65. pieweii#0000

    like as i searched it was like u should use k means on your dataset folder and set number of clusters because all my images in same file and unlabelled

  66. pieweii#0000

    so its not bad too much

  67. wafa_ath#0000

    it’s great that it only took 30mn

  68. wafa_ath#0000

    no it’s not

  69. wafa_ath#0000

    it’s good

  70. pieweii#0000

    i was like no way im going to read more i hotta make sure this gonna work first my head was honna explode of learning literally

  71. pieweii#0000

    so im gonna study that one then

  72. wafa_ath#0000

    oh, ask gpt to summrize them haha, best of luck

  73. pieweii#0000

    the teacher will ask me about all functions πŸ₯²

  74. wafa_ath#0000

    omg , your words is so hartwarming , don’t worry about it girl ❀️

  75. pieweii#0000

    yeh im gonna read one by one and understand what’s happening inside and thank you so muchh @wafa_ath i will never forget your help my whole life πŸ™πŸ»β€οΈβœ¨οΈ

  76. pieweii#0000

    i will make sure i return this favor as long as im alive ✨️

  77. pieweii#0000

    the reason im thankful to you it’s because you wre the only one who helped me even tho i knew anything about all this and how i took my first steps. neither the teacher ir enterprise cared and it was just me and i joined 2 more server before this i was wishing i find someone that knows about this i searched everywhere because there was no hope left chat gpt messed enough with me and everutime i saw something i had to open YouTube books articles and everytime i learn a new thing i doesnt work at the end. that made my brain so blocked like i just want this to work i dont wann understand anything else i read about contrastive learning transfer learning kmeans hierarchical clustering dbcan elbow beale duda and hart methods feature extraction, i used only 2 of them at the end

  78. pieweii#0000

    hehe, but i would say it was good to learn, and you are my saver πŸ™πŸ»βœ¨οΈ

  79. wafa_ath#0000

    But that is a journey of learning, happy to ba part of it, i will be here for you, and i hope someone else find out convo and help him too ..

  80. pieweii#0000

    i was thinking istead of using kmeans for clustering dataset to for pseudo labeling why dont i just cluster then by myself in folder because using kmeans might make mistakes?

  81. pieweii#0000

    image.pngimage.pngimage.pngimage.pngimage.png

  82. wafa_ath#0000

    Did you try that yet ?

  83. pieweii#0000

    yehh i did

  84. pieweii#0000

    i also found a solution for getting good threshold depending on my inputs i found in an article i will share it with you tomorrow

  85. wafa_ath#0000

    How’s the results

  86. pieweii#0000

    yehh it did

  87. pieweii#0000

    oh wait

  88. pieweii#0000

    i answered on wrong msg

  89. pieweii#0000
  90. pieweii#0000

    its clustering well honestly

  91. pieweii#0000

    this link contains how to estimate the value of threshold

  92. pieweii#0000

    idk if you hear about weibull

CONTRIBUTE TO THIS THREAD

Browse other questions tagged 

Leaderboard

RANKED BY XP

All time
  • 1.
    Avatar
    @Nayel115
    1620 XP
  • 2.
    Avatar
    @UcGee
    650 XP
  • 3.
    Avatar
    @melta101
    600 XP
  • 4.
    Avatar
    @chitour
    600 XP
  • 5.
    Avatar
    @lifegochi
    250 XP
  • 6.
    Avatar
    @Youuce
    180 XP