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

YoloV2 full weights loading, loss function and annotation parser #17

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

iuliancioarca
Copy link
Contributor

Hi,

I managed to generate the full V2 model and to load weights into it (example in Readme). I also worked on the loss function. Basically I tried to continue your work from the 'initial branch'. I had to run in parallel the python code in order to check the array dimensions, otherwise it's a nightmare. There are some differences in the returned values between the two implementations (I think they are related to tf.sparse_softmax_cross_entropy_with_logits), but I only tested on some dummy arrays filled with zeros and ones. What I find strange about the python implementation is that calling the loss function with the same variable as true&predicted array will not return 0 (as I expected).
Anyway, I think the best way to test it is to load some actual data. I also started writing the xml annotation parser for VOC in order to store info in some Julia struct.

Iulian

@codecov-io
Copy link

codecov-io commented Dec 21, 2019

Codecov Report

Merging #17 into master will decrease coverage by 20.29%.
The diff coverage is 37%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #17      +/-   ##
=======================================
- Coverage   57.29%   37%   -20.3%     
=======================================
  Files          11    13       +2     
  Lines         274   427     +153     
=======================================
+ Hits          157   158       +1     
- Misses        117   269     +152
Impacted Files Coverage Δ
src/parse_voc_xml.jl 0% <0%> (ø)
src/models/v2/loadweights.jl 0% <0%> (ø) ⬆️
src/makierendering.jl 0% <0%> (ø) ⬆️
src/loss.jl 0% <0%> (ø)
src/datasets.jl 100% <100%> (ø) ⬆️
src/YOLO.jl 100% <100%> (ø) ⬆️
src/pretrained.jl 100% <100%> (ø) ⬆️
src/models/v2_tiny/loadweights.jl 100% <100%> (ø) ⬆️
src/models/v2/v2.jl 3.57% <3.57%> (+3.57%) ⬆️
src/postprocess.jl 63.79% <63.79%> (ø) ⬆️
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 583e38c...fb738b5. Read the comment docs.

@Ybakman
Copy link
Contributor

Ybakman commented Dec 29, 2019

Hi,
The trainable version is available => https://github.com/Ybakman/YoloV2-Trainable
I really appreciate any feedback.

Yavuz

@iuliancioarca
Copy link
Contributor Author

Hi,

Many thanks for the great work!
I tried to run accuracy/training but I always run out of memory at the Pre-processing images step. It seems that all the 5011 images cannot fit in my 16GB of RAM. How much RAM does your computer have? Maybe it's best to generate minibatches directly from disk instead of partitioning them from the fully loaded data.

Iulian

@IanButterworth
Copy link
Owner

Great stuff @iuliancioarca ! and @Ybakman awesome to see it training!!

I think before we merge this PR, we need to make sure that all tests are passing, and that we're not regressing any existing functionality (or at least if we do there's a decent reason to). For instance, this should still serve the v2-tiny version as well as the v2 full etc.

@iuliancioarca do you think you could try to get the CI tests to pass? I can add you as collaborators on the CI platforms so that you can cancel/restart instances if that helps?

@Ybakman
Copy link
Contributor

Ybakman commented Jan 4, 2020

Hi,

Many thanks for the great work!
I tried to run accuracy/training but I always run out of memory at the Pre-processing images step. It seems that all the 5011 images cannot fit in my 16GB of RAM. How much RAM does your computer have? Maybe it's best to generate minibatches directly from disk instead of partitioning them from the fully loaded data.

Iulian

As I work on amazon aws p2x.large machines, memory was not a problem. But you indicate a critical point. I will try to solve it.

However, if you want to try it now, in preprocessing.jl write =>
"return images[1:500],labels[1:500]" instead of "return images,labels" in inputandlabelsdir function. Therefore, you train on 500 images but hopefully get sensible trained model.

@iuliancioarca
Copy link
Contributor Author

Thanks! I managed to train a model with reasonable accuracy even with the reduced number of images.
@ianshmean maybe it's best to include the code from @Ybakman since he went ahead and his version already works. The only extra thing in my fork is the full V2 network that can be borrowed at any time.

@IanButterworth
Copy link
Owner

Ok, absorbing https://github.com/Ybakman/YoloV2-Trainable makes sense before this PR. @Ybakman would you be able to put together a PR that passes CI tests? I'd do it myself but, I'm afraid I don't have much free time currently

@Ybakman
Copy link
Contributor

Ybakman commented Jan 9, 2020

Ok, absorbing https://github.com/Ybakman/YoloV2-Trainable makes sense before this PR. @Ybakman would you be able to put together a PR that passes CI tests? I'd do it myself but, I'm afraid I don't have much free time currently

I've 5 exams in the following 5 days but I can handle that as soon as possible after the final exams.

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

Successfully merging this pull request may close these issues.

None yet

4 participants