A method of recognizing, by an electronic device, an object included in a data set to be analyzed using a neural network model, the method comprising:
- receiving the data set;
- and
- inputting the received data set to a compressed neural network model to generate an output value corresponding to a value identifying an object included in an image of the data set,
- wherein the compressed neural network model is compressed from an original model using an optimized pruning ratio determined for at least one layer of the original model based on ratios for each object size of objects included in the image of the data set, and
- the optimized pruning ratio is calculated for the data set based on the determined weight by calculating performance decline rates for each object size of the original model according to pruning based on ratios for each object size and determining weights for pruning ratios for each object size in consideration of the performance decline rates for each object size.