{"id":1053,"date":"2020-07-01T09:27:52","date_gmt":"2020-07-01T02:27:52","guid":{"rendered":"http:\/\/www.miai.vn\/?p=1053"},"modified":"2020-07-01T09:27:52","modified_gmt":"2020-07-01T02:27:52","slug":"lazy-boy-thu-xay-dung-he-thong-tu-dong-chinh-mau-anh-bang-mobilenetv2","status":"publish","type":"post","link":"https:\/\/miai.vn\/?p=1053","title":{"rendered":"&#8220;Lazy boy&#8221; th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2"},"content":{"rendered":"\n<p>Xin ch\u00e0o tu\u1ea7n m\u1edbi c\u00e1c mem, h\u00f4m nay ch\u00fang ta th\u1eed \u0111\u00f3ng vai m\u1ed9t &#8220;lazy boy&#8221; th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u cho \u1ea3nh nh\u00e1.<\/p>\n\n\n\n<p>Ch\u1ea3 l\u00e0 anh ch\u00e0ng &#8220;lazy boy&#8221; c\u00f3 m\u1ed9t c\u00f4 ng\u01b0\u1eddi y\u00eau kh\u00f3 t\u00ednh g\u1eedi cho 1 t\u1eadp \u1ea3nh v\u00e0 y\u00eau c\u1ea7u ch\u1ec9nh m\u00e0u cho c\u00f4. V\u1ed1n s\u1eb5n t\u00ednh l\u01b0\u1eddi n\u00ean lazy boy mu\u1ed1n code ra m\u1ed9t h\u1ec7 th\u1ed1ng c\u00f3 th\u1ec3 l\u00e0m thay anh ta \u0111i\u1ec1u \u0111\u00f3 kh\u00f4ng th\u00ec ch\u1ebft v\u1edbi c\u00f4 ng\u01b0\u1eddi y\u00eau =)).<\/p>\n\n\n\n<p>Quan s\u00e1t l\u1ea1i c\u00e1c \u1ea3nh m\u00e0 c\u00f4 ng\u01b0\u1eddi y\u00eau \u0111\u00e3 s\u1eeda v\u00e0 up facebook tr\u01b0\u1edbc \u0111\u00e2y, ch\u00e0ng lazy boy nh\u1eadn ra r\u1eb1ng h\u00f3a ra c\u00f3 quy lu\u1eadt c\u1ea3. M\u1ed7i lo\u1ea1i \u1ea3nh th\u00ec c\u00f4 n\u00e0ng \u0111\u1ec1u apply v\u1edbi m\u1ed9t lo\u1ea1i ch\u1ec9nh m\u00e0u ri\u00eang. Kaka.<\/p>\n\n\n\n<p>Th\u1ebf l\u00e0 ch\u00e0ng l\u01b0\u1eddi m\u1edbi quy\u1ebft \u0111\u1ecbnh t\u1ea1o ra m\u1ed9t ph\u1ea7n m\u1ec1m t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u tu\u1ef3 v\u00e0o \u1ea3nh cho nhanh g\u1ecdn g\u1ed3m 2 lo\u1ea1i:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>N\u1ebfu \u1ea3nh ngo\u00e0i tr\u1eddi th\u00ec th\u00eam ch\u00fat n\u1eafng \u1ea5m<\/li><li>N\u1ebfu \u1ea3nh &#8220;gi\u01b0\u1eddng chi\u1ebfu&#8221;\/trong nh\u00e0 th\u00ec th\u00eam t\u1eb9o Saphire ch\u1ed1ng noise<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/static.javatpoint.com\/tutorial\/opencv\/images\/opencv-image-filters.png\" alt=\"t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u\"\/><figcaption>Ngu\u1ed3n: <a href=\"https:\/\/static.javatpoint.com\/tutorial\/opencv\/images\/opencv-image-filters.png\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">T\u1ea1i \u0111\u00e2y<\/a><\/figcaption><\/figure>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p>R\u1ed3i , t\u1ea1m th\u1ebf \u0111\u00e3, n\u1ebfu \u1ed5n th\u00ec s\u1ebd l\u00e0m v\u1edbi t\u1ea5t c\u1ea3 c\u00e1c lo\u1ea1i \u1ea3nh c\u1ee7a n\u00e0ng g\u1eedi =))<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ph\u1ea7n 1 &#8211; Ph\u00e2n t\u00edch b\u00e0i to\u00e1n t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh<\/h2>\n\n\n\n<p>V\u1edbi b\u00e0i to\u00e1n n\u00e0y ta c\u00f3 th\u1ec3 ngh\u0129 t\u1edbi c\u00e1c k\u1ef9 thu\u1eadt nh\u01b0 sau:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\u00c1p d\u1ee5ng k\u1ef9 thu\u1eadt transfer learning v\u1edbi m\u1ea1ng <strong><a href=\"https:\/\/arxiv.org\/abs\/1801.04381\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener nofollow\">MobileNetV2<\/a><\/strong> \u0111\u1ec3 t\u0103ng t\u1ed1c \u0111\u1ed9 train v\u00e0 inference. M\u1ea1ng n\u00e0y s\u1ebd d\u00f9ng \u0111\u1ec3 nh\u1eadn di\u1ec7n xem h\u00ecnh \u1ea3nh input l\u00e0 \u1ea3nh gi\u01b0\u1eddng chi\u1ebfu\/trong nh\u00e0 hay \u1ea3nh ngo\u00e0i tr\u1eddi.<\/li><li>S\u1eed d\u1ee5ng OpenCV \u0111\u1ec3 t\u1ea1o ra c\u00e1c filter cho \u1ea3nh v\u00e0 \u00e1p d\u1ee5ng c\u00e1c filter cho c\u00e1c b\u1ee9c \u1ea3nh t\u01b0\u01a1ng \u1ee9ng v\u1edbi class m\u00e0 m\u1ea1ng \u1edf b\u01b0\u1edbc tr\u00ean predict ra.<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/miro.medium.com\/max\/1882\/1*bqE59FvgpvoAQUMQ0WEoUA.png\" alt=\"mobilenet v2\"\/><figcaption>Ngu\u1ed3n: <a href=\"https:\/\/miro.medium.com\/max\/1882\/1*bqE59FvgpvoAQUMQ0WEoUA.png\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener nofollow\">T\u1ea1i \u0111\u00e2y<\/a><\/figcaption><\/figure>\n\n\n\n<p>Ch\u00fang ta s\u1ebd s\u1eed d\u1ee5ng b\u1ed9 d\u1eef li\u1ec7u g\u1ed3m c\u00e1c \u1ea3nh indoor v\u00e0 outdoor \u0111\u1ec3 train. C\u00e1c b\u1ea1n c\u00f3 th\u1ec3 t\u1ea3i b\u1ed9 d\u1eef li\u1ec7u t\u1ea1i Th\u01b0 vi\u1ec7n M\u00ec AI: <strong><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/miai.vn\/thu-vien-mi-ai\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/miai.vn\/thu-vien-mi-ai<\/a><\/strong> . B\u1ea1n xem video clip \u0111\u1ec3 bi\u1ebft c\u00e1ch t\u1ea3i v\u1ec1. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ph\u1ea7n 2 &#8211; X\u00e2y d\u1ef1ng c\u00e1c filter cho \u1ea3nh<\/h2>\n\n\n\n<p>Nh\u01b0 \u0111\u00e3 n\u00f3i \u1edf tr\u00ean, sau khi nh\u1eadn di\u1ec7n \u0111\u01b0\u1ee3c \u1ea3nh \u0111\u01b0a v\u00e0o l\u00e0 trong nh\u00e0 hay ngo\u00e0i tr\u1eddi th\u00ec model s\u1ebd \u00e1p d\u1ee5ng c\u00e1c filter \u1ea3nh t\u01b0\u01a1ng \u1ee9ng (th\u00eam m\u00e0u \u1ea5m, sapie&#8230;). Nh\u01b0 v\u1eady ch\u00fang ta ph\u1ea3i vi\u1ebft s\u1eb5n c\u00e1c filter n\u00e0y cho model, vi\u1ec7c n\u00e0y \u0111\u01a1n gi\u1ea3n b\u1eb1ng opencv thu\u1ea7n th\u00f4i. V\u00ed d\u1ee5 \u0111\u00e2y l\u00e0 2 filter c\u1ea7n d\u00f9ng trong b\u00e0i:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># H\u00e0m t\u1ea1o filter sapie\ndef apply_sepia(frame, intensity=0.5):\n    frame = verify_alpha_channel(frame)\n    frame_h, frame_w, frame_c = frame.shape\n    sepia_bgra = (20, 66, 112, 1)\n    overlay = np.full((frame_h, frame_w, 4), sepia_bgra, dtype='uint8')\n    cv2.addWeighted(overlay, intensity, frame, 1.0, 0, frame)\n    return frame\n\n# H\u00e0m t\u1ea1o filter m\u00e0u\n\ndef apply_color_overlay(frame, intensity=0.5, blue=0, green=0, red=0):\n    frame = verify_alpha_channel(frame)\n    frame_h, frame_w, frame_c = frame.shape\n    sepia_bgra = (blue, green, red, 1)\n    overlay = np.full((frame_h, frame_w, 4), sepia_bgra, dtype='uint8')\n    cv2.addWeighted(overlay, intensity, frame, 1.0, 0, frame)\n    return frame<\/code><\/pre>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p>Trong project c\u1ee7a m\u00ecnh, c\u00e1c filter n\u00e0y \u0111\u01b0\u1ee3c l\u01b0u v\u00e0o file filters.py \u0111\u1ec3 c\u00e1c file kh\u00e1c c\u00f3 th\u1ec3 import v\u00e0 s\u1eed d\u1ee5ng cho nhanh g\u1ecdn.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ph\u1ea7n 3 &#8211;  Train model nh\u1eadn di\u1ec7n c\u1ea3nh trong\/ngo\u00e0i <\/h2>\n\n\n\n<h5 class=\"wp-block-heading\">Chu\u1ea9n b\u1ecb d\u1eef li\u1ec7u<\/h5>\n\n\n\n<p>B\u00e0i n\u00e0y m\u00ecnh s\u1ebd s\u1eed d\u1ee5ng k\u1ef9 thu\u1eadt image generator. \u0110\u00e2y l\u00e0 m\u1ed9t k\u1ef9 thu\u1eadt th\u00f4ng d\u1ee5ng m\u00e0 m\u00ecnh \u0111\u00e3 s\u1eed d\u1ee5ng trong r\u1ea5t nhi\u1ec1u b\u00e0i. <\/p>\n\n\n\n<p>Th\u01b0 m\u1ee5c <strong>data<\/strong> c\u1ee7a ch\u00fang ta s\u1ebd ch\u1ee9a 2 th\u01b0 m\u1ee5c con:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>indoor: th\u01b0 m\u1ee5c n\u00e0y ch\u1ee9a 400 file \u1ea3nh trong nh\u00e0, gi\u01b0\u1eddng chi\u1ebfu, b\u00e0n \u0103n&#8230;.<\/li><li>outdoor: th\u01b0 m\u1ee5c n\u00e0y ch\u1ee9a 400 file \u1ea3nh ngo\u00e0i tr\u1eddi, b\u00e3i bi\u1ec3n, n\u00fai non&#8230;<\/li><\/ul>\n\n\n\n<p>D\u1eef li\u1ec7u n\u00e0y c\u00e1c b\u1ea1n t\u1ea3i t\u1ea1i Th\u01b0 vi\u1ec7n M\u00ec AI: <strong><a href=\"https:\/\/miai.vn\/thu-vien-mi-ai\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\">https:\/\/miai.vn\/thu-vien-mi-ai<\/a><\/strong> . B\u1ea1n xem video clip \u0111\u1ec3 bi\u1ebft c\u00e1ch t\u1ea3i v\u1ec1.<\/p>\n\n\n\n<p>B\u00e2y gi\u1edd ta s\u1ebd s\u1eed d\u1ee5ng Image Generator \u0111\u1ec3 load d\u1eef li\u1ec7u t\u1eeb 2 folder tr\u00ean, s\u1eed d\u1ee5ng t\u00ean folder l\u00e0m nh\u00e3n:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    # \u0110\u01b0\u1eddng d\u1eabn \u0111\u1ebfn folder \u1ea3nh\n    data_dir = pathlib.Path('.\/data')\n    \n    # T\u00ean class l\u1ea5y b\u1eb1ng \u0111\u00fang t\u00ean th\u01b0 m\u1ee5c (indoor, outdoor)\n    class_names = np.array(&#91;folder.name for folder in data_dir.glob('*') if folder.name != \".DS_Store\"])\n\n    # T\u1ea1o ra m\u1ed9t image_gen, c\u00f3 th\u1ef1c hi\u1ec7n rescale\n    image_generator = ImageDataGenerator(rescale=1\/255, validation_split=0.2)\n\n    train_data_gen = image_generator.flow_from_directory(directory=str(data_dir), batch_size=batch_size,\n                                                        classes=list(class_names), target_size=(input_size&#91;0], input_size&#91;1]),\n                                                        shuffle=True, subset=\"training\")\n\n    test_data_gen = image_generator.flow_from_directory(directory=str(data_dir), batch_size=batch_size,\n                                                        classes=list(class_names), target_size=(input_size&#91;0], input_size&#91;1]),\n                                                        shuffle=True, subset=\"validation\")<\/code><\/pre>\n\n\n\n<p>C\u00e1c b\u1ea1n \u0111\u1ec3 \u00fd m\u00ecnh c\u00f3 d\u00f9ng rescale \u0111\u1ec3 \u0111\u01b0a c\u00e1c gi\u00e1 tr\u1ecb trong \u1ea3nh v\u1ec1 kho\u1ea3ng [0,1] nh\u00e9.<\/p>\n\n\n\n<p>R\u1ed3i, data v\u1eady l\u00e0 okie, n\u1ebfu c\u00e1c b\u1ea1n ch\u1ea1y th\u00e0nh c\u00f4ng s\u1ebd th\u1ea5y hi\u1ec7n ra m\u00e0n h\u00ecnh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Found 640 images belonging to 2 classes.\nFound 160 images belonging to 2 classes.<\/code><\/pre>\n\n\n\n<p>D\u00f2ng tr\u00ean l\u00e0 s\u1ed1 \u1ea3nh cho train v\u00e0 d\u00f2ng th\u1ee9 2 l\u00e0 s\u1ed1 \u1ea3nh cho validation nh\u00e9.<\/p>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<h5 class=\"wp-block-heading\">T\u1ea1o c\u1ea5u tr\u00fac model<\/h5>\n\n\n\n<p>Trong b\u00e0i n\u00e0y m\u00ecnh s\u1ebd s\u1eed d\u1ee5ng m\u1ea1ng MobilenetV2 v\u00e0 c\u00f3 x\u00e0o n\u1ea5u t\u00fd \u0111\u1ec3 gh\u00e9p n\u1ed1i th\u00e0nh m\u1ea1ng c\u1ee7a m\u00ecnh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Load MobileNetV2\n    mobilenet_model = MobileNetV2(input_shape=input_shape)\n    # B\u1ecf \u0111i layer cu\u1ed1i c\u00f9ng (FC)\n    mobilenet_model.layers.pop()\n    # \u0110\u00f3ng b\u0103ng c\u00e1c layer (tr\u1eeb 4 layer cu\u1ed1i)\n    for layer in mobilenet_model.layers&#91;:-4]:\n        layer.trainable = False\n\n    mobilenet_output = mobilenet_model.layers&#91;-1].output\n\n    # T\u1ea1o c\u00e1c layer m\u1edbi\n    output = Dense(num_classes, activation=\"softmax\")\n    # L\u1ea5y input t\u1eeb output c\u1ee7a MobileNet\n    output = output(mobilenet_output)\n\n    # T\u1ea1o model v\u1edbi input c\u1ee7a MobileNet v\u00e0 output l\u00e0 l\u1edbp Dense v\u1eeba th\u00eam\n    model = Model(inputs=mobilenet_model.inputs, outputs=output)\n\n    # In c\u1ea5u tr\u00fac m\u1ea1ng\n    model.summary()\n    # Compile model\n    model.compile(loss=\"categorical_crossentropy\", optimizer=\"adam\", metrics=&#91;\"accuracy\"])<\/code><\/pre>\n\n\n\n<p>V\u00e0 c\u1ea5u tr\u00fac m\u1ea1ng c\u1ee7a ch\u00fang ta s\u1ebd \u0111\u01b0\u1ee3c in ra m\u00e0n h\u00ecnh:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>__________________________________________________________________________________________________\ndense_1 (Dense)                 (None, 2)            2562        global_average_pooling2d_1&#91;0]&#91;0] \n==================================================================================================\nTotal params: 2,260,546\nTrainable params: 414,722\nNon-trainable params: 1,845,824\n__________________________________________________________________________________________________<\/code><\/pre>\n\n\n\n<p>C\u00e1c b\u1ea1n \u0111\u1ec3 \u00fd model Dense m\u00e0 ta \u0111\u00e3 th\u00eam v\u00e0o \u0111\u00e3 \u0111\u00fang. T\u1ed5ng s\u1ed1 tham s\u1ed1 c\u1ee7a m\u1ea1ng l\u00e0 2,260,546 trong \u0111\u00f3 c\u00f3 414,722 \u0111\u00e3 fix c\u1ee9ng, c\u00f2n l\u1ea1i 1,845,824 tham s\u1ed1 s\u1ebd \u0111\u01b0\u1ee3c train.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">Train model<\/h5>\n\n\n\n<p>Okie r\u1ed3i, train th\u00f4i c\u00e1c b\u1ea1n:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u0110\u1ecbnh ngh\u0129a batch_size v\u00e0 epochs\nbatch_size = 32\nepochs = 1\n\n# Load c\u00e1c data gen\ntrain_generator, validation_generator, class_names = get_generator()\n\n# T\u1ea1o model\nmodel = get_model(num_classes = len(class_names))\n\n# T\u1ea1o callback \u0111\u1ec3 l\u1ea5y weight m\u1edbi nh\u1ea5t\ncheckpoint = ModelCheckpoint(\"models\/my_model-\" + \"-loss-{val_loss:.2f}-acc-{val_accuracy:.2f}.h5\", save_best_only=True, verbose=1)\n\n\n# Train model\ntraining_steps_per_epoch = np.ceil(train_generator.samples \/ batch_size)\nvalidation_steps_per_epoch = np.ceil(validation_generator.samples \/ batch_size)\nmodel.fit_generator(train_generator, steps_per_epoch=training_steps_per_epoch,\n                    validation_data=validation_generator, validation_steps=validation_steps_per_epoch,\n                    epochs=epochs, verbose=1, callbacks=&#91; checkpoint])\n\n# L\u01b0u model sau khi train xong all epochs\nmodel.save(\"models\/my_model.h5\")<\/code><\/pre>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p>\u1ede \u0111\u00e2y c\u00e1c b\u1ea1n c\u1ea7n ch\u00fa \u00fd 2 v\u1ea5n \u0111\u1ec1:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Thay \u0111\u1ed5i s\u1ed1 epoch theo nhu c\u1ea7u v\u00e0 d\u1eef li\u1ec7u c\u1ee7a c\u00e1c b\u1ea1n sao cho loss h\u1ed9i t\u1ee5.<\/li><li>Sau khi train xong s\u1ebd c\u00f3 2 file:<ul><li>M\u1ed9t file .hdf5: L\u00e0 file weights t\u1ed1t nh\u1ea5t m\u00ecnh s\u1eed d\u1ee5ng <strong><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/callbacks\/ModelCheckpoint\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Model Checkpoint <\/a><\/strong>\u0111\u1ec3 l\u01b0u l\u1ea1i.<\/li><li>M\u1ed9t file .h5: L\u00e0 file model cu\u1ed1i c\u00f9ng sau khi train all c\u00e1c epochs.<\/li><\/ul><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Ph\u1ea7n 4 &#8211; Ki\u1ec3m th\u1eed model t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh<\/h2>\n\n\n\n<p>B\u00e2y gi\u1edd ch\u00fang ta th\u1eed nghi\u1ec7m xem model ch\u1ea1y th\u1ebf n\u00e0o v\u1edbi d\u1eef li\u1ec7u th\u1ef1c t\u1ebf n\u00e0o.<\/p>\n\n\n\n<p>Ch\u00fang ta s\u1ebd \u0111\u01b0a v\u00e0o m\u1ed9t b\u1ee9c \u1ea3nh, \u0111\u1ecdc \u1ea3nh v\u00e0 chuy\u1ec3n th\u00e0nh tensor (nh\u1edb rescale \/ 255) v\u00e0 predict:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Thay \u0111\u1ed5i \u1ea3nh \u1edf \u0111\u00e2y\nimage_path = \"test_data\/b.jpg\"\n\n# \u0110\u1ecdc \u1ea3nh\nimage = cv2.imread(image_path)\nimage_org = image.copy()\n\n# Chuy\u1ec3n \u0111\u1ed5i th\u00e0nh tensor\nimage = cv2.resize(image, dsize=input_size&#91;:2])\nimage = image\/255\nimage = np.expand_dims(image, axis=0)\n\n# T\u1ea1o model\nmodel = get_model()\n\n# load the optimal weights\nmodel.load_weights(\"models\/my_model--loss-0.41-acc-0.94.h5\")\n\n# Ti\u1ebfn h\u00e0nh predict\nclass_names = &#91;'indoor','landscape']\noutput = model.predict(image)<\/code><\/pre>\n\n\n\n<p>Output c\u1ee7a ch\u00fang ta s\u1ebd l\u00e0 m\u1ed9t vector $p$ nh\u01b0 sau:<\/p>\n\n\n\n<p>$$p = \\begin{bmatrix} p1 &amp; p2 \\end{bmatrix}$$<\/p>\n\n\n\n<p>Trong \u0111\u00f3 :<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>$p1$: L\u00e0 x\u00e1c xu\u1ea5t \u1ea3nh \u0111\u1ea7u v\u00e0o l\u00e0 indoor<\/li><li>$p2$: L\u00e0 x\u00e1c xu\u1ea5t \u1ea3nh \u0111\u1ea7u v\u00e0o l\u00e0 outdoor <\/li><\/ul>\n\n\n\n<p>Do \u0111\u00f3 ch\u00fang ta ch\u1ec9 c\u1ea7n d\u00f9ng $np.argmax$ l\u00e0 c\u00f3 th\u1ec3 l\u1ea5y \u0111\u01b0\u1ee3c gi\u00e1 tr\u1ecb 0,1 \u0111\u1ec3 bi\u1ebft \u1ea3nh hi\u1ec7n t\u1ea1i \u0111ang l\u00e0 class n\u00e0o:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class_name = class_names&#91;np.argmax(output)]<\/code><\/pre>\n\n\n\n<p>V\u00e0 b\u01b0\u1edbc cu\u1ed1i c\u00f9ng, khi \u0111\u00e3 bi\u1ebft class \u1ea3nh ta s\u1ebd \u00e1p d\u1ee5ng c\u00e1c filter t\u01b0\u01a1ng \u1ee9ng:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\n# N\u1ebfu l\u00e0 landscape th\u00ec apply overlay\nif class_name == \"landscape\":\n    filter_image = filters.apply_color_overlay(image_org, intensity=.2, red=250, green=100, blue=0)\n    cv2.putText(filter_image,class_name,(50,50),cv2.FONT_HERSHEY_SIMPLEX,1,(0,255,0),2)\nelse:\n    # N\u1ebfu l\u00e0 indoor th\u00ec apply sepia\n    filter_image = filters.apply_sepia(image_org, intensity=.8)\n    cv2.putText(filter_image, class_name, (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)\n\ncv2.imshow('orginal_color', image_org)\ncv2.imshow('color_overlay', filter_image)\ncv2.waitKey()\ncv2.destroyAllWindows()<\/code><\/pre>\n\n\n\n<ins class=\"adsbygoogle\" style=\"display:block\" data-ad-client=\"ca-pub-5095883280136027\" data-ad-slot=\"7735063137\" data-ad-format=\"auto\" data-full-width-responsive=\"true\"><\/ins>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script>\n\n\n\n<p>\u1ede \u0111\u00e2y m\u00ecnh s\u1ebd th\u1eed v\u1edbi 2 \u1ea3nh <strong>KH\u00d4NG C\u00d3 TRONG T\u1eacP TRAIN<\/strong> \u0111\u1ec3 xem model nh\u01b0 n\u00e0o. V\u00e0 k\u1ebft qu\u1ea3 kh\u00e1 \u1ed5n!<\/p>\n\n\n\n<p>V\u1edbi \u1ea3nh ngo\u00e0i tr\u1eddi th\u00ec s\u1ebd \u0111\u01b0\u1ee3c th\u00eam ch\u00fat &#8220;n\u1eafng \u1ea5m xa d\u1ea7n&#8221;:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/MiAI_Auto_Image_Filter\/blob\/master\/Screen%20Shot%202020-07-01%20at%2016.10.20.png?raw=true\" alt=\"\"\/><\/figure>\n\n\n\n<p>C\u00f2n n\u1ebfu l\u00e0 \u1ea3nh &#8220;gi\u01b0\u1eddng chi\u1ebfu&#8221;\/trong ph\u00f2ng th\u00ec th\u00eam t\u00fd hi\u1ec7u \u1ee9ng Sapie n\u00e0o cho n\u00f3 \u1ea5m c\u00fang (anh em n\u00e0o nh\u1eadn ra \u1ea3nh n\u00e0y quen ko nh\u1edf \ud83d\ude00 )<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/github.com\/thangnch\/MiAI_Auto_Image_Filter\/blob\/master\/Screen%20Shot%202020-07-01%20at%2016.07.44.png?raw=true\" alt=\"\"\/><\/figure>\n\n\n\n<p>M\u00ecnh c\u00f3 code vi\u1ebft s\u1eb5n k\u00e8m file pretrain h5 t\u1ea1i <strong><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/github.com\/thangnch\/MiAI_Auto_Image_Filter\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">github<\/a><\/strong> n\u00e0y nh\u00e9. C\u00e1c b\u1ea1n c\u00f3 th\u1ec3 t\u1ea3i v\u1ec1 \u0111\u1ec3 th\u1eed lu\u00f4n.<\/p>\n\n\n\n<p>Ch\u00fac c\u00e1c b\u1ea1n th\u00e0nh c\u00f4ng!<\/p>\n\n\n\n<p>#M\u00ecAI<\/p>\n\n\n\n<p>Fanpage:\u00a0<a href=\"http:\/\/facebook.com\/miaiblog\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/facebook.com\/miaiblog<\/a><br>Group trao \u0111\u1ed5i, chia s\u1ebb:\u00a0<a href=\"https:\/\/www.facebook.com\/groups\/miaigroup\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.facebook.com\/groups\/miaigroup<\/a><br>Website:\u00a0<a href=\"http:\/\/miai.vn\/\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/miai.vn<\/a><br>Youtube:\u00a0<a href=\"http:\/\/bit.ly\/miaiyoutube\" target=\"_blank\" rel=\"noreferrer noopener\">http:\/\/bit.ly\/miaiyoutube<\/a><\/p>\n\n\n\n<p>C\u1ea3m \u01a1n b\u00e0i tham kh\u1ea3o tuy\u1ec7t v\u1eddi <a href=\"https:\/\/github.com\/codingforentrepreneurs\/OpenCV-Python-Series\/blob\/master\/src\/filter.py\" target=\"_blank\" aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener nofollow\">t\u1ea1i \u0111\u00e2y<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Xin ch\u00e0o tu\u1ea7n m\u1edbi c\u00e1c mem, h\u00f4m nay ch\u00fang ta th\u1eed \u0111\u00f3ng vai m\u1ed9t &#8220;lazy boy&#8221; th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u cho \u1ea3nh nh\u00e1. Ch\u1ea3 l\u00e0 anh ch\u00e0ng &#8220;lazy boy&#8221; c\u00f3 m\u1ed9t c\u00f4 ng\u01b0\u1eddi y\u00eau kh\u00f3 t\u00ednh g\u1eedi cho 1 t\u1eadp \u1ea3nh v\u00e0 y\u00eau c\u1ea7u ch\u1ec9nh m\u00e0u cho c\u00f4. V\u1ed1n s\u1eb5n [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27],"tags":[319,320,321,56,322,323,324,243,325,28,326],"class_list":["post-1053","post","type-post","status-publish","format-standard","hentry","category-computer-vision","tag-chinh-mau-anh","tag-color","tag-filter","tag-image","tag-image-auto-filter","tag-image-classify","tag-image-filter","tag-keras","tag-mobilenetv2","tag-opencv","tag-tu-dong-chinh-mau"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2 - M\u00ec AI<\/title>\n<meta name=\"description\" content=\"Xin ch\u00e0o tu\u1ea7n m\u1edbi c\u00e1c mem M\u00ec AI, h\u00f4m nay ch\u00fang ta th\u1eed \u0111\u00f3ng vai m\u1ed9t &quot;lazy boy&quot; th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh nh\u00e1.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/miai.vn\/?p=1053\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2 - M\u00ec AI\" \/>\n<meta property=\"og:description\" content=\"Xin ch\u00e0o tu\u1ea7n m\u1edbi c\u00e1c mem M\u00ec AI, h\u00f4m nay ch\u00fang ta th\u1eed \u0111\u00f3ng vai m\u1ed9t &quot;lazy boy&quot; th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh nh\u00e1.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/miai.vn\/?p=1053\" \/>\n<meta property=\"og:site_name\" content=\"M\u00ec AI\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-01T02:27:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/static.javatpoint.com\/tutorial\/opencv\/images\/opencv-image-filters.png\" \/>\n<meta name=\"author\" content=\"Ch\u1ee7 ti\u1ec7m M\u00ec\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ch\u1ee7 ti\u1ec7m M\u00ec\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1053#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1053\"},\"author\":{\"name\":\"Ch\u1ee7 ti\u1ec7m M\u00ec\",\"@id\":\"https:\\\/\\\/miai.vn\\\/#\\\/schema\\\/person\\\/cc8bc24bb90bd3f596add82f3a59948c\"},\"headline\":\"&#8220;Lazy boy&#8221; th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2\",\"datePublished\":\"2020-07-01T02:27:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1053\"},\"wordCount\":1400,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1053#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/static.javatpoint.com\\\/tutorial\\\/opencv\\\/images\\\/opencv-image-filters.png\",\"keywords\":[\"ch\u1ec9nh m\u00e0u \u1ea3nh\",\"color\",\"filter\",\"image\",\"image auto filter\",\"image classify\",\"image filter\",\"keras\",\"MobileNetV2\",\"opencv\",\"t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u\"],\"articleSection\":[\"Computer Vision\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/miai.vn\\\/?p=1053#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1053\",\"url\":\"https:\\\/\\\/miai.vn\\\/?p=1053\",\"name\":\"Th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2 - M\u00ec AI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1053#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1053#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/static.javatpoint.com\\\/tutorial\\\/opencv\\\/images\\\/opencv-image-filters.png\",\"datePublished\":\"2020-07-01T02:27:52+00:00\",\"description\":\"Xin ch\u00e0o tu\u1ea7n m\u1edbi c\u00e1c mem M\u00ec AI, h\u00f4m nay ch\u00fang ta th\u1eed \u0111\u00f3ng vai m\u1ed9t \\\"lazy boy\\\" th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh nh\u00e1.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1053#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/miai.vn\\\/?p=1053\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1053#primaryimage\",\"url\":\"https:\\\/\\\/static.javatpoint.com\\\/tutorial\\\/opencv\\\/images\\\/opencv-image-filters.png\",\"contentUrl\":\"https:\\\/\\\/static.javatpoint.com\\\/tutorial\\\/opencv\\\/images\\\/opencv-image-filters.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/miai.vn\\\/?p=1053#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/miai.vn\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"&#8220;Lazy boy&#8221; th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/miai.vn\\\/#website\",\"url\":\"https:\\\/\\\/miai.vn\\\/\",\"name\":\"M\u00ec AI\",\"description\":\"H\u1ecdc AI theo c\u00e1ch M\u00ec \u0103n li\u1ec1n!\",\"publisher\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/miai.vn\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/miai.vn\\\/#organization\",\"name\":\"M\u00ec AI\",\"url\":\"https:\\\/\\\/miai.vn\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/miai.vn\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/miai.vn\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/cropped-Logo_w_slogan.png\",\"contentUrl\":\"https:\\\/\\\/miai.vn\\\/wp-content\\\/uploads\\\/2026\\\/05\\\/cropped-Logo_w_slogan.png\",\"width\":240,\"height\":193,\"caption\":\"M\u00ec AI\"},\"image\":{\"@id\":\"https:\\\/\\\/miai.vn\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/miai.vn\\\/#\\\/schema\\\/person\\\/cc8bc24bb90bd3f596add82f3a59948c\",\"name\":\"Ch\u1ee7 ti\u1ec7m M\u00ec\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g\",\"caption\":\"Ch\u1ee7 ti\u1ec7m M\u00ec\"},\"sameAs\":[\"https:\\\/\\\/miai.vn\"],\"url\":\"https:\\\/\\\/miai.vn\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2 - M\u00ec AI","description":"Xin ch\u00e0o tu\u1ea7n m\u1edbi c\u00e1c mem M\u00ec AI, h\u00f4m nay ch\u00fang ta th\u1eed \u0111\u00f3ng vai m\u1ed9t \"lazy boy\" th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh nh\u00e1.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/miai.vn\/?p=1053","og_locale":"en_US","og_type":"article","og_title":"Th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2 - M\u00ec AI","og_description":"Xin ch\u00e0o tu\u1ea7n m\u1edbi c\u00e1c mem M\u00ec AI, h\u00f4m nay ch\u00fang ta th\u1eed \u0111\u00f3ng vai m\u1ed9t \"lazy boy\" th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh nh\u00e1.","og_url":"https:\/\/miai.vn\/?p=1053","og_site_name":"M\u00ec AI","article_published_time":"2020-07-01T02:27:52+00:00","og_image":[{"url":"https:\/\/static.javatpoint.com\/tutorial\/opencv\/images\/opencv-image-filters.png","type":"","width":"","height":""}],"author":"Ch\u1ee7 ti\u1ec7m M\u00ec","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Ch\u1ee7 ti\u1ec7m M\u00ec","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/miai.vn\/?p=1053#article","isPartOf":{"@id":"https:\/\/miai.vn\/?p=1053"},"author":{"name":"Ch\u1ee7 ti\u1ec7m M\u00ec","@id":"https:\/\/miai.vn\/#\/schema\/person\/cc8bc24bb90bd3f596add82f3a59948c"},"headline":"&#8220;Lazy boy&#8221; th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2","datePublished":"2020-07-01T02:27:52+00:00","mainEntityOfPage":{"@id":"https:\/\/miai.vn\/?p=1053"},"wordCount":1400,"commentCount":0,"publisher":{"@id":"https:\/\/miai.vn\/#organization"},"image":{"@id":"https:\/\/miai.vn\/?p=1053#primaryimage"},"thumbnailUrl":"https:\/\/static.javatpoint.com\/tutorial\/opencv\/images\/opencv-image-filters.png","keywords":["ch\u1ec9nh m\u00e0u \u1ea3nh","color","filter","image","image auto filter","image classify","image filter","keras","MobileNetV2","opencv","t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u"],"articleSection":["Computer Vision"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/miai.vn\/?p=1053#respond"]}]},{"@type":"WebPage","@id":"https:\/\/miai.vn\/?p=1053","url":"https:\/\/miai.vn\/?p=1053","name":"Th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2 - M\u00ec AI","isPartOf":{"@id":"https:\/\/miai.vn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/miai.vn\/?p=1053#primaryimage"},"image":{"@id":"https:\/\/miai.vn\/?p=1053#primaryimage"},"thumbnailUrl":"https:\/\/static.javatpoint.com\/tutorial\/opencv\/images\/opencv-image-filters.png","datePublished":"2020-07-01T02:27:52+00:00","description":"Xin ch\u00e0o tu\u1ea7n m\u1edbi c\u00e1c mem M\u00ec AI, h\u00f4m nay ch\u00fang ta th\u1eed \u0111\u00f3ng vai m\u1ed9t \"lazy boy\" th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh nh\u00e1.","breadcrumb":{"@id":"https:\/\/miai.vn\/?p=1053#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/miai.vn\/?p=1053"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/miai.vn\/?p=1053#primaryimage","url":"https:\/\/static.javatpoint.com\/tutorial\/opencv\/images\/opencv-image-filters.png","contentUrl":"https:\/\/static.javatpoint.com\/tutorial\/opencv\/images\/opencv-image-filters.png"},{"@type":"BreadcrumbList","@id":"https:\/\/miai.vn\/?p=1053#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/miai.vn\/"},{"@type":"ListItem","position":2,"name":"&#8220;Lazy boy&#8221; th\u1eed x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ec9nh m\u00e0u \u1ea3nh b\u1eb1ng MobileNetV2"}]},{"@type":"WebSite","@id":"https:\/\/miai.vn\/#website","url":"https:\/\/miai.vn\/","name":"M\u00ec AI","description":"H\u1ecdc AI theo c\u00e1ch M\u00ec \u0103n li\u1ec1n!","publisher":{"@id":"https:\/\/miai.vn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/miai.vn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/miai.vn\/#organization","name":"M\u00ec AI","url":"https:\/\/miai.vn\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/miai.vn\/#\/schema\/logo\/image\/","url":"https:\/\/miai.vn\/wp-content\/uploads\/2026\/05\/cropped-Logo_w_slogan.png","contentUrl":"https:\/\/miai.vn\/wp-content\/uploads\/2026\/05\/cropped-Logo_w_slogan.png","width":240,"height":193,"caption":"M\u00ec AI"},"image":{"@id":"https:\/\/miai.vn\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/miai.vn\/#\/schema\/person\/cc8bc24bb90bd3f596add82f3a59948c","name":"Ch\u1ee7 ti\u1ec7m M\u00ec","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b0b5124b0d2c0a8054d7127d2c236bdc3dc7a50e2d4e8728ab32eee5b122a8d1?s=96&d=mm&r=g","caption":"Ch\u1ee7 ti\u1ec7m M\u00ec"},"sameAs":["https:\/\/miai.vn"],"url":"https:\/\/miai.vn\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/miai.vn\/index.php?rest_route=\/wp\/v2\/posts\/1053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/miai.vn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/miai.vn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/miai.vn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/miai.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1053"}],"version-history":[{"count":0,"href":"https:\/\/miai.vn\/index.php?rest_route=\/wp\/v2\/posts\/1053\/revisions"}],"wp:attachment":[{"href":"https:\/\/miai.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/miai.vn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/miai.vn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}