agentmorris / MegaDetector

MegaDetector is an AI model that helps conservation folks spend less time doing boring things with camera trap images.
MIT License
116 stars 24 forks source link

make_classification_dataset with custom train/test split #27

Closed agentmorris closed 1 year ago

agentmorris commented 1 year ago

Thanks for making this great repo!

I love that make_classification_dataset.py allows you to crop images using the megadetector and create the tfrecords at the same time. One thing that has not been clear to me is how to specify a specific train/test split rather than having the script automatically split across locations.

Is there a way to do this?


Issue cloned from Microsoft/CameraTraps, original issue posted by davidwhealey on Apr 21, 2020.

agentmorris commented 1 year ago

Hi there! Unfortunately that's not possible right now (we're looking to change this in the summer), but as a workaround, you can run the script on your training set images and set the split ratio to have zero test images (to create the training tfrecords), and then again on the test set, specifying for there to be zero training images (to create the test tfrecords).


(Comment originally posted by yangsiyu007)

agentmorris commented 1 year ago

I was getting a nonempty test.json even with a zero training image fraction, which I did not investigate further. But what I ended up doing was to create custom train.json and test.json files in the cropped dataset, then ran data_management/tfrecords/create_tfrecords_from_coco.py That appears to have worked.


(Comment originally posted by davidwhealey)