In this paper, we propose a Heterogeneous MEC System Framework based on Transfer Learning (HMECSF-TL), which uses convolutional neural network (CNN) to process few training samples. In view of the time-varying network environment and the limited end devices resources, the HMECSF-TL framework uses transfer learning (TL) technology to optimize the CNN model and jointly optimizes the allocation of computing resources and communication resources, which is beneficial to achieve the dual goals of extending the use time of end devices and improving the speed and the accuracy of image classification. We first introduce the Quality of Content (QoC)-driven MEC transfer system architecture of cloud-edge-end. The cloud server uses the existing image dataset to train the general neural network model in advance and transfer the general model to the edge servers, and then the edge servers deploy the local models to the end devices to form the personalized models. Then, considering the time-varying situation of the network environment, in order to get the updated model faster and better, we present the process of collaborative optimization of model between the edge sever and multiple end devices, using an edge server as an example. Considering the limited resources of the end devices, we propose a joint optimization of energy and latency with the goal of minimizing offloading cost, in order to rapidly improve the speed and the accuracy of image classification with few training samples under the premise of rational resource allocation and verify the performance of the framework experimentally. Simulation results show that the proposed HMECSF-TL framework outperforms the benchmark strategy without TL in terms of reducing the model training time and improving the image classification accuracy, as well as reducing the offloading cost.