Recognizing the gender of Cannabis is a lot easier than people think. Cannabis is a dioecious plant, meaning it has male and female plants, the males are useful for breeding but the female is what we are after. You can identify the female by the distinct white hairs in a "V" shape. The preflower usually starts on the main stem. The males which usually flower first, grow a cantaloupe shaped pollen that opens eventually and, will pollinate all surrounding females, resulting in seeds.
To grow superior cannabis, you need to grow "sensimilla", which means without seeds, so recognizing the gender is very important, and should happen early, to avoid unwanted spoiled crops.