First, you should know the concepts of True Positive(TP), False Negative(FN),
False Positive(FP) and True Negative(TN).
These four items form the confusion matrix.
You can define a Positive class as you want, e.g. you can choose Dog as
postive class(often, we choose the class we care most as the positive class, like cancer vs. non-cancer case, we set cancer as positive class).
Then if the image is with a dog(we call it groudtruth), you predict it as a dog, you get TP;
if the image is with a cat, you predict it as a cat, you get TN;
if the image is with a dog, you predict it as a cat, you get FN;
if the image is with a cat, you predict it as a dog, you get FP.
Now you can count the number of TP, TN, FN, FP as #TP, #TN, #FN, #FP.
So the Precison is defined as: TP / (TP + FP);
Recall is defined as: TP / (TP + FN)
You can see from the above fomula, Preciosn means how many predictions you made are right of all you predictions while Recall means how many actual positive classes you predictions have coverd.