matpalm / bnn

bee detection tensorflow conv net for a rasp pi on side of a hive
http://matpalm.com/blog/counting_bees/
MIT License
405 stars 67 forks source link

default config #5

Closed matpalm closed 6 years ago

matpalm commented 6 years ago

having to include default flags across different scripts is annoying

e.g. --base-filter-size 4 --no-use-batch-norm --width 1024 height 768

would make sense to move these into a config.json and standardise mixing the contents of this with the use of argparse

squeakus commented 6 years ago

Have you implemented this? I have started scripting the input but I could easily set up a config.json that would be overwritten by any args passed in.

matpalm commented 6 years ago

haven't yet; a couple of reasons why...

1) the main thing that was annoying me was having to specify things related to the model spec; (specifcally use_skip_connections, base_filter_size & use_batch_norm ) when you running inference (predict.py or test.py or anything else using a pre trained model) and it occured to me that you can actually derive this values by just checking the checkpoint..

2) height and width continue to be more complex since the work i'm tinkering with for domain adversarial and meta learning (via MAML) mix a number of different types of images, each with their own height / width; so it's a bit more complex :/

squeakus commented 6 years ago

Automatically extracting those settings from the pretrained model is a better solution. I may implement the width/height on my fork as i'm not doing anything fancy but have differently sized image datasets. BTW did you get any improvement from training on image patches rather than full size images. Do you think I could get more out of my dataset using data augmentation on the images?

matpalm commented 6 years ago

yeah patches have been the best thing i've done so far in terms of regularisation. not surprising i guess given how little other regularisation i've added :/ smaller patches => bigger batches which, with a larger learning rate, makes things more consistent too IMHO

if you intend to work on a fixed size of images you should definitely including at least cropping (not square patches as the code does, more like what i originally had, the classic crop to a random offsetted (H-B, W-B) during training and center cropped during inference.

there's also a subtle bug re: materialising the label bitmaps & rotation i need to address. it's not a big thing but since i noticed it, it's been annoying me :/ i should write it up in an issue