|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 1,
- "id": "f6ebc90f-d3ee-4c90-9187-4030f1019166",
- "metadata": {},
- "outputs": [],
- "source": [
- "import sys\n",
- "sys.path.append(\"/home/shanwei-luo/userdata/mmdetection\")\n",
- "from mmdet.apis import (async_inference_detector, inference_detector,\n",
- " init_detector, show_result_pyplot)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 27,
- "id": "a51a9ad6-b8f4-4c77-a87c-c7d402480d47",
- "metadata": {},
- "outputs": [],
- "source": [
- "config_file = 'work_dirs/AD_dsxw_test03/AD_dsxw_test03.py'\n",
- "checkpoint_file = 'work_dirs/AD_dsxw_test03/epoch_20.pth'\n",
- "img_path = '/home/shanwei-luo/userdata/datasets/dsxw_test/images/'"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 28,
- "id": "d50982fc-bc48-4dca-b192-0fbacc65d868",
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "load checkpoint from local path: work_dirs/AD_dsxw_test03/epoch_20.pth\n"
- ]
- }
- ],
- "source": [
- "model = init_detector(config_file, checkpoint_file, device='cuda:0')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 98,
- "id": "a1ade22e-7130-46ae-aa57-409585cc788e",
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "/home/shanwei-luo/userdata/datasets/dsxw_test/images/21000160.jpg\n"
- ]
- }
- ],
- "source": [
- "import os\n",
- "import random\n",
- "imgs = os.listdir(img_path)\n",
- "img_id = random.randint(0, len(imgs))\n",
- "img = imgs[img_id]\n",
- "img = '/home/shanwei-luo/userdata/datasets/dsxw_test/images/'+img\n",
- "print(img)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 101,
- "id": "feb228fa-b0cd-44ce-bcaa-802f4ce741ef",
- "metadata": {},
- "outputs": [
- {
- "data": {
|