<commit_before>{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Check how many layers are frozen in :\n",
    "#  https://github.com/ShehabMMohamed/TinyImageNet-KaggleCompetition\n",
    "\n",
    "from keras.applications import Xception\n",
    "from keras.layers import Input, Dense"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "img_height = 299\n",
    "img_width = 299\n",
    "\n",
    "input_tensor = Input(shape=(img_width, img_height, 3))\n",
    "\n",
    "pre_trained_model = Xception(weights='imagenet', input_tensor=input_tensor, include_top=False, pooling='avg')\n",
    "# Downloads 83.7Mb of model..., "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "pre_trained_model.layers[20].name\n",
    "# 'block3_sepconv2' ( next are 'block3_sepconv2_bn' and 'conv2d_2' )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "pre_trained_model.summary()\n",
    "#Total params: 20,861,480\n",
    "#Trainable params: 20,806,952\n",
    "#Non-trainable params: 54,528\n",
    "# Input ... block3_sepconv2 ... block14_sepconv2 ... global_average_pooling2d_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "### That's a lot of fine tuning..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",<commit_msg>PyTorch xception has 12 blocks rather than 14...<commit_after>{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Check how many layers are frozen in :\n",
    "\n",
    "https://github.com/ShehabMMohamed/TinyImageNet-KaggleCompetition"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from keras.applications import Xception\n",
    "from keras.layers import Input, Dense"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "img_height = 299\n",
    "img_width = 299\n",
    "\n",
    "input_tensor = Input(shape=(img_width, img_height, 3))\n",
    "\n",
    "pre_trained_model = Xception(weights='imagenet', input_tensor=input_tensor, include_top=False, pooling='avg')\n",
    "# Downloads 83.7Mb of model..., "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "pre_trained_model.layers[20].name\n",
    "# 'block3_sepconv2' ( next are 'block3_sepconv2_bn' and 'conv2d_2' )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "pre_trained_model.summary()\n",
    "#Total params: 20,861,480\n",
    "#Trainable params: 20,806,952\n",
    "#Non-trainable params: 54,528\n",
    "# Input ... block3_sepconv2 ... block14_sepconv2 ... global_average_pooling2d_1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "### That's a lot of fine tuning..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Should check the layout of the PyTorch model too...\n",
    "\n",
    "https://github.com/Cadene/pretrained-models.pytorch/blob/master/pretrainedmodels/models/xception.py#L137\n",
    "\n",
    "Seems to be only 12 blocks, which is a little odd..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
{'fraction_non_alphanumeric': 0.21053892215568862, 'fraction_numerical': 0.02467065868263473, 'mean_word_length': 2.9582938388625593, 'pattern_counts': {'":': 86, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7152320', 'n_tokens_mistral': 1655, 'n_tokens_neox': 1565, 'n_words': 283}