File Exchange

image thumbnail

Two-stream CNN for Gender recognition using hand images

version (309 KB) by Mahmoud Afifi
Implementation of our paper "11K Hands: Gender recognition and biometric identification using hand images"


Updated 08 May 2019

View License

This is the Matlab implementation of the paper:
Mahmoud Afifi, "11K Hands: Gender recognition and biometric identification using a large dataset of hand images." Multimedia Tools and Applications, 2019.
Please cite the following work if you use the provided source code, pre-trained models, or the dataset:
Mahmoud Afifi, "11K Hands: Gender recognition and biometric identification using a large dataset of hand images." Multimedia Tools and Applications, 2019
Project webpage:

Cite As

Afifi, Mahmoud. “11K Hands: Gender Recognition and Biometric Identification Using a Large Dataset of Hand Images.” Multimedia Tools and Applications, Springer Nature, Mar. 2019, doi:10.1007/s11042-019-7424-8.

View more styles

Comments and Ratings (12)

@azza elbagoury: check my answer here
I gave an example of how to split two stacked images via conv layers with no learning rate. Hope it would help.

For "second-stream" what if the input will be 3-channels, to fully utilize the pretrained AlexNet weights. This is done by converting the detailed image (I) to grayscale 3-channels image, by concatenating three copies of the original matrix along the third dimension [cat(3,I,I,I)].
which of the two cases are better for pretrained deep convolution network: The input is 1-channel OR the input is 3-channels (All 3-channels are same).
Regardless the issue of input which will be 6D tensor.

@azza elbagoury: yes you can. But you need to modify it based on your architecture for segmentation. You can use the same idea of using tiff images to store input for two streams and split them by the first conv layer. Then, you can do whatever you want for segmentation.

Many thanks for your great effort.
Could this "two stream" model be modified to segmentation task instead of classification?

@mohamed attia: when you call plot(lgraph), you can see the final form of the network which has two skipConv layers (skipConv1 and skipConv2). The idea is that, I constructed the two input images together as a 4D tensor. So, first 3 layers are for the RGB input image (first stream) and the last layer is for the grayscale image (second stream). skinpConv1 and skipConv2 have zeros in the corresponding layer to split the input into two different inputs (RGB image and grayscale image). Then each stream will be fed with the corresponding input.

Great work, thanks for your effort.
In twoStreams.m you have arranged the layers of net1 and net2 sequentially, where layer(26) 'relu1_2' is taking the output of layer(25) 'fc9_1' as its input.
Isn't this suppose to be two parallel streams? where layer(25) is the last layer in net1 and layer(26) is the first layer in net2.


Did you use Matlab 2016a or higher? The activations function is introduced starting from Matlab 2016a ( I have checked the code again and it is working!


Got an error in get_all_features.m. The errors are as follows:
> In get_all_features (line 20)
Undefined function or variable 'activations'.

Error in getfeatures (line 29)
features.low = reshape ( activations(net, testingImage, featureLayer),[1,531]);

Error in get_all_features (line 28)
please help. Thanks in advance.

Aasma Aslam

Really good effort and help for the others

M Shannon

Great work!


preprocessing function is updated


Reference paper was updated.



Paper title was updated

bug fixed in demo.m file

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.

Learn About Live Editor