Commit bafcc961 authored by AnjanaChankya's avatar AnjanaChankya

updated

parent 9c6a12a2
This diff is collapsed.
fileFormatVersion: 2
guid: b550460db09851742b2d65451d883fc8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "interiordesign.ipynb",
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "code",
"metadata": {
"id": "etQVpMwMo0sM",
"colab_type": "code",
"colab": {}
},
"source": [
"!pip install tensorflow==2.0.0-alpha0"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "KsYQ8kg7N7t1",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 128
},
"outputId": "46323a9b-e9b5-4464-eb1c-ac1bac86cfa5"
},
"source": [
"from google.colab import drive\n",
"drive.mount(\"/content/drive\")"
],
"execution_count": 19,
"outputs": [
{
"output_type": "stream",
"text": [
"Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&response_type=code&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly\n",
"\n",
"Enter your authorization code:\n",
"··········\n",
"Mounted at /content/drive\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "MifFpfpQOb0l",
"colab_type": "code",
"colab": {}
},
"source": [
"train_file = \"/content/drive/My Drive/Colab Notebooks/train.zip\""
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "u0Cw01q4O7GY",
"colab_type": "code",
"colab": {}
},
"source": [
"import zipfile\n",
"\n",
"with zipfile.ZipFile(train_file, 'r') as z:\n",
" z.extractall()"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "9kNfJK3mPj0Z",
"colab_type": "code",
"colab": {}
},
"source": [
"import os\n",
"import cv2\n",
"\n",
"def load_image(file_path):\n",
" return cv2.imread(file_path)\n",
"\n",
"def extract_lable(file_name):\n",
" return 1 if \"sofa\" in file_name else 0\n",
"\n",
"train_path = \"./train/\"\n",
"image_files = os.listdir(train_path)\n",
"train_images = [load_image(train_path + file) for file in image_files]\n",
"train_labels = [extract_lable(file) for file in image_files]"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "S3caWwt3TBfz",
"colab_type": "code",
"colab": {}
},
"source": [
"def preprocess_image(image, side=96):\n",
" min_side = min(img.shape[0], img.shape[1])\n",
" img = img [:min_side, :min_side]\n",
" img = cv2.resize()\n"
],
"execution_count": 0,
"outputs": []
}
]
}
\ No newline at end of file
fileFormatVersion: 2
guid: bc54159bd2e21544881a52dcb673d842
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment