oist / Usiigaci

Usiigaci: stain-free cell tracking in phase contrast microscopy enabled by supervised machine learning
MIT License
192 stars 68 forks source link

About the pretrain weight that in the train.py #8

Closed Ayanzadeh93 closed 5 years ago

Ayanzadeh93 commented 5 years ago

Hello,

I want to train the model from scratch, so I run the train.py. but i figure out that it needs a .h5 file entitled "mask_rcnn_nuclei_new.h5" and i cannot find it anywhere and you do not put any link to your GitHub page. I will be grateful if you help with this.

hftsai commented 5 years ago

Hi the pretrained weights are here https://www.dropbox.com/sh/3eldgvytfchm9gr/AAB6vzPaEf8buk81IRVNClUEa?dl=0 Please change the file name. to any of the modelweight. you only need one to work.

Ayanzadeh93 commented 5 years ago

@hftsai Thanks for your response. I have another question, out of the Usiigaci pretrain weight, could we use the pretrain weights of other models such as deepcell or other similar works.

hftsai commented 5 years ago

No I don't believe so.

A model weight is very specific to a neural network architecture. If there is a change in the network architecture, differences in number of parameters changed, then the model weight is not something easily transferrable to my understanding.

Since this work is based on the mask rcnn implementation from Matterport, a pretrained model weight of this exact architecture is usable.

Ayanzadeh93 commented 5 years ago

@hftsai Thank you so much for your response and consideration. I am so sorry that ask very question, But i have another important question about this Architecture. In the training of the dataset from scratch could we give the 16 bit images as input or this model just prepared for 8bit images? because the images that i want to import for training set is 16 bit.

hftsai commented 5 years ago

@Ayanzadeh93 Hi First, i would like to highly recommend against training from scratch. It will most certainly not work if you sample size is small. remember one of the drawback for the residual network (backbone in maskrcnn) is that it's very deep so it takes more time to train.

Note the raw images we feed for training in training data (raw.tif) they are 16bit (as originally outputted from nikon microscopes) So yes, 16 bit is preferred.

Ayanzadeh93 commented 5 years ago

I am really thankful for your consideration.

Ayanzadeh93 commented 5 years ago

Sorry, I have another question, I prepared my dataset for training. Now, I am training my dataset with your pre-train dataset but in the trained_network directory, I have faced with lots of .h5 file and some folders that have the template like "cell20190210T1307". Hence, my question is that which of this .h5 files are my primary pretrain file for prediction in Inference.py

hftsai commented 5 years ago

The model weights from each epoch is saved into hdf5 files (.h5). We are adding a function in the training script in future to select the best model weight based on accuracy and loss, but right now it hasn't been validated yet. But basically you can use the model weight from the last epoch.

These file names are automatically generated based on the finishing time of the epoch. You can rename it of course for later inference ease. these are just for experiment tracking purposes.

Ayanzadeh93 commented 5 years ago

@hftsai Thanks for your response, But i train the code (10 epoch for the training of the heads of network and 20 epochs for training all layers). My Training file contains 34 images that have an Instance aware ground truth. But I keep your input in the training steps to compare the results in the prediction I faced with very different result. My question is that , is my dataset number for training is so low or there is another problem? As i understand, your input data are learned in earlier steps(in code head of network is set to 100 and all layer is set to 200). So in your viewpoint should i increase the epoch number to 100 or more or my problem is another things. I put the comparison of my input with your output results in determined epochs. I forgot to say that i just put 15 dataset for training but total of them about 30( in this training 45 your input images and 15 of my input data in total 60 image)

your input

20180101ef002xy01t14

Your data outputs:

20180101ef002xy01t14

my Input data:

t000

My result :

t000

hftsai commented 5 years ago

I see you're using the dataset from the celltrackingchallenge.

this kind of results happen when the training is not yet optimal, you should definitely train for more epoch and increase training sets as possible.

I stated in other threads that we started trying number of training data from 10 and increases from there. If the training data is too little it impacts the results quite a bit. (even for 50, it's still a small training dataset, and the results right now are ok, but from the preprint you can see there are definitely room to improve).

note also... one thing i haven't figured out or actually test out is if you mix different sizes of input images. I supposed these U373Mg or U87Mg images form celltrackingchallenge is not 1024x1022. and of course the magnification is not the same.

Intuitively i think if the input images becomes diverse, the neural network needs much more data to train even if it's capable of it. It is one of the reason i always only use the images from our own microscope and did not mix with other people's data.

Other groups using only their data, seems to work when they retrain the model.

hftsai commented 5 years ago

Closing the issue as it was not updated for 14 days. Please start a new one if it persists.