How to choose a batch size
The short answer is that batch size itself can be considered a hyperparameter, so experiment with training using different batch sizes and evaluate the performance for each batch size on the validation set.
The long answer is that the effect of different batch sizes is different for every model. For example, when using GPU acceleration, training can physically become faster if you increase your batch size until you saturate GPU load. Decreasing batch size can also affect performance if your network has BatchNorm layers, it might improve your network's performance or it might decrease it.
There is no hard and fast rule when it comes to a network of your own design, and more often than not I find it common (both anecdotally and in literature) that for large convolutional nets the batch size is chosen to be the biggest that can actually fit on the GPU.
How to chose number of epochs while training a NN
The answer here is early stopping. Instead of 'choosing' a number of epochs you instead save the network weights from the 'best' epoch. This optimal epoch is determined by validation loss. After each epoch you predict on the validation set and calculate the loss. Whenever the validation loss after an epoch beats the previous best (i.e. is lower) you checkpoint network state, overwriting the previous checkpoint made at the previous 'best' epoch. If the validation loss doesn't improve after, for example, 10 epochs you can stop training.
Tensorflow has built-in support for early stopping in Keras for both the sequential API and functional API, and if you're using a custom training loop you can implement the early stopping logic quite easily yourself.