robail-yasrab / RootNav-2.0

Plant Phenotyping APP
BSD 3-Clause "New" or "Revised" License
41 stars 18 forks source link

--resume-iterations flag & auto download model feature #16

Closed YnzeHiemstra closed 6 months ago

mikepound commented 6 months ago

Thanks for the contributions – I’ve had a look, please could you (for now) remove the download bit and only pull request the resumption of iterations code. The reason is the download bit should work with the published models in the json, rather than via hard coded urls, because that way if we were to ever add new models or update the urls this would only need to happen in the json file. Essentially the training code should have no reference to the cvl urls at all I think, this should be dynamically determined at runtime. The inference code uses the class ModelLoader for this.

If we merge the iteration code to begin with, a strategy for downloading can be sorted later. Or, you can continue to tweak this implementation if you’d prefer.

Mike

mikepound commented 6 months ago

Ok great - I think it is very close. Please could you incorporate the logger.error() into a single call that includes the text within the print also, to avoid two lines and use of print() completely. Like so:

logger.error(f"Listed target iteration number of {cfg['training']['train_iters']} is lower than the iteration number of the transfer learning model {checkpoint['epoch']}. Please rerun training without continuing iterations or by specifying a higher total number of iterations")

Similarly, please switch the print lines under the elif about the URLs to logger.info() rather than print. E.g.

logger.info("plant models can be downloaded using the following links:")