This document proposes a novel deep learning framework to detect gastric cancer from endoscopic images of the stomach. The framework uses a patch-based analysis where features are extracted from image patches and evaluated for cancer risk. A bag-of-features technique is then applied to the extracted features from selected patches for analysis. Experimental results show the proposed framework can effectively and efficiently detect gastric cancer from images and identify minute lesions. It achieves higher accuracy than other models using the same dataset. The framework is also more accurate than existing methods for gastric cancer detection.