{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "initial_id", "metadata": { "ExecuteTime": { "end_time": "2024-09-08T09:41:41.074231Z", "start_time": "2024-09-08T09:41:41.044494Z" }, "collapsed": true }, "outputs": [], "source": [ "from typing import List, Dict, Union\n", "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "import klib as kl\n", "import missingno as mns\n", "import os\n", "import warnings\n", "\n", "\n", "os.environ['KERAS_BACKEND']='tensorflow'\n", "os.environ[\"CUDA_VISIBLE_DE VICES\"]=\"0\"\n", "os.environ[\"KMP_DUPLICATE_LIB_OK\"]=\"TRUE\"\n", "warnings.filterwarnings('ignore')\n", "plt.rcParams['font.sans-serif'] = ['Kaiti']\n", "plt.rcParams['axes.unicode_minus'] = False\n", "PIC_PATH = \"../../models/image/cleaning/\"\n", "DATA_PATH = '../../data/data/'\n", "RESULT_PATH = '../../data/summary/cleaning/'\n", "MODEL_PATH = '../../models/cleaning/'" ] }, { "cell_type": "code", "execution_count": 2, "id": "fce34e6f181696a1", "metadata": { "ExecuteTime": { "end_time": "2024-09-08T09:41:41.104699Z", "start_time": "2024-09-08T09:41:41.090180Z" } }, "outputs": [], "source": [ "import pathlib2 as pl2\n", "import shutil\n", "\n", "def creat_dir():\n", " pic_path = pl2.Path(PIC_PATH)\n", " if os.path.exists(PIC_PATH):\n", " shutil.rmtree(PIC_PATH)\n", " pic_path.mkdir(parents=True, exist_ok=True)\n", " if not os.path.exists(RESULT_PATH):\n", " os.mkdir(RESULT_PATH)\n", " if not os.path.exists(MODEL_PATH):\n", " os.mkdir(MODEL_PATH)\n", "\n", "creat_dir()" ] }, { "cell_type": "code", "execution_count": 3, "id": "47986cc296c6c67b", "metadata": { "ExecuteTime": { "end_time": "2024-09-08T09:41:41.120399Z", "start_time": "2024-09-08T09:41:41.105873Z" } }, "outputs": [], "source": [ "figure_count = 0\n", "\n", "def create_figure(figure_name: str, dpi=800):\n", " global figure_count\n", " figure_count += 1\n", " plt.savefig(PIC_PATH + f'/figure{figure_count}_{figure_name}.png', dpi=dpi)" ] }, { "cell_type": "code", "execution_count": 4, "id": "5895b73198de6066", "metadata": { "ExecuteTime": { "end_time": "2024-09-08T09:41:52.005356Z", "start_time": "2024-09-08T09:41:41.121545Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", " | 方向 | \n", "时间 | \n", "车牌号 | \n", "交叉口 | \n", "
---|---|---|---|---|
0 | \n", "3 | \n", "2024-04-03T14:39:08.632 | \n", "AF5B7CEM | \n", "环西路-纬中路 | \n", "
1 | \n", "1 | \n", "2024-04-03T17:45:32.316 | \n", "BK2IA84 | \n", "环西路-纬中路 | \n", "
2 | \n", "3 | \n", "2024-04-03T15:09:04.087 | \n", "AF4EC7FK | \n", "环西路-纬中路 | \n", "
3 | \n", "2 | \n", "2024-04-03T11:49:03.665 | \n", "AF4MBB6 | \n", "环西路-纬中路 | \n", "
4 | \n", "3 | \n", "2024-04-01T11:47:49.391 | \n", "CBA7KCG | \n", "环西路-纬中路 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
8844991 | \n", "2 | \n", "2024-05-06T19:03:30.000 | \n", "无车牌 | \n", "经中路-环南路 | \n", "
8844992 | \n", "1 | \n", "2024-05-04T12:21:28.000 | \n", "无车牌 | \n", "经中路-环南路 | \n", "
8844993 | \n", "1 | \n", "2024-05-06T16:55:47.000 | \n", "无车牌 | \n", "经中路-环南路 | \n", "
8844994 | \n", "2 | \n", "2024-05-06T07:30:43.000 | \n", "无车牌 | \n", "经中路-环南路 | \n", "
8844995 | \n", "2 | \n", "2024-05-06T14:12:02.000 | \n", "无车牌 | \n", "经中路-环南路 | \n", "
8844996 rows × 4 columns
\n", "