Recent

Author Topic: FPC Neural Networks + Places2: 1.8 million training images - TESTING HAS STARTED  (Read 1446 times)

schuler

  • Full Member
  • ***
  • Posts: 230
 :) Hello everyone :)
I think that the importance of the moment deserves a new topic.

Previous methods of the API load the full set of training images into memory. This was ok or even stretched with:

For a dataset with 1.8 million images, keeping everything into RAM wouldn't work. Places2 standard has 1.8 million training images:
http://places2.csail.mit.edu/download.html

For my own tests, I'm downloading "Small images (256 * 256) with easy directory structure with 21GB".

A solution for this is currently in testing. The folder structure is loaded into RAM with:
Code: Pascal  [Select][+][-]
  1.    
  2.     FTrainingFileNames, FValidationFileNames, FTestFileNames: TFileNameList;
  3. ...
  4.     ProportionToLoad := 1;
  5.     CreateFileNameListsFromImagesFromFolder(
  6.       FTrainingFileNames, FValidationFileNames, FTestFileNames,
  7.       {FolderName=}'places_folder/train', {pImageSubFolder=}'',
  8.       {TrainingProp=}0.9*ProportionToLoad,
  9.       {ValidationProp=}0.05*ProportionToLoad,
  10.       {TestProp=}0.05*ProportionToLoad
  11.     );

There is a new fitting class capable of working with the above:
Code: Pascal  [Select][+][-]
  1.     NeuralFit := TNeuralImageLoadingFit.Create;
  2.     ...
  3.     NeuralFit.FitLoading({NeuralNetworkModel}NN, {ImageSizeX}256, {ImageSizeY}256, FTrainingFileNames, FValidationFileNames, FTestFileNames, {BatchSize}256, {Epochs}100);

Is it bug free? I don't know. It's currently in testing. My current test case is modifying a source code intended for Plant Village dataset by just switching the folder name:
https://github.com/joaopauloschuler/neural-api/blob/master/examples/SimplePlantLeafDisease/SimplePlantLeafDiseaseLoadingAPI.pas

When creating the model (the neural network), the number of classes comes straight from the dataset:
Code: Pascal  [Select][+][-]
  1. NN.AddLayer([
  2.       TNNetInput.Create(FSizeX, FSizeY, 3),
  3.       ...
  4.       TNNetFullConnectLinear.Create(FTrainingFileNames.ClassCount),
  5.       TNNetSoftMax.Create()
  6.     ]);

:) Wish everyone happy pascal coding. May the source be with you. :)
« Last Edit: April 27, 2021, 04:00:06 am by schuler »

Editor

  • New Member
  • *
  • Posts: 25
Hi. it looks fantastic. Could yo tell more about the whole code?

Laksen

  • Hero Member
  • *****
  • Posts: 755
    • J-Software
Really cool library, and excellent information on github

I'm curious about whether you have support for fixed point datatypes of any kind?

 

TinyPortal © 2005-2018