Hi Zzuczy!



 zzuczy:

is it necessary for me to up-sample the DOG pictures to make the samples balanced?


Yes, almost certainly.  With a nine-to-one Not-DOG / DOG ratio your
model could achieve 90% accuracy just by classifying all samples as
Not-DOG.
So (assuming 10% DOG samples in your training set) you would
want to sample any given DOG sample 9 times as often as any
given Not-DOG sample.  (If you’re working with batches it would be
helpful to have each batch be approximately half-and-half DOG and
Not-DOG samples.)
You could also use BCEWithLogitsLoss's pos_weight constructor
argument (set equal to 9.0, with DOG being your “positive” class),
but I would only recommend this if the size of your batches and your
training dataset is such that up-sampling causes a typical batch to
contain multiple duplicate DOG samples (which I do not think will be
true for you).
Best.
K. Frank