This code show how to train a cell detector using a convolutional neural network in Lasagne.
Look at main.ipynb.
- Python 2 or 3
- The python packages in requirements.txt, if you have pip you can install them using:
pip3 install -r requirements.txt
- Each image is manually annotated with the center point of each cell as well as some hard negative examples
- All points within
sample radius
of a cell centre are sampled aspositive samples
- An equal number of
negative samples
are randomly sampled outside thepositive radius
- All points within
sample radius
of the hard negative examples are sampled asnegative samples
- A convolutional neural network is trained using the negative and positive samples. For each sample, a box of size
box_size
, is used as input to the network. - Given a new image a
box_sized
window is slided through each possible patch in the image, generating a probability map - Local maxima in the probability map are marked as cell centers
Note: There is no padding on the boundary so no detection is possible box_size/2
pixels from the image boundary.
The network and code structure is based on Lasanges MNIST
example
https://github.com/Lasagne/Lasagne/blob/master/examples/mnist.py