efengx commited on
Commit
d5b8eea
·
1 Parent(s): 4dcf678

fix: update

Browse files
Files changed (2) hide show
  1. fengx_launch.ipynb +7 -7
  2. fengxai/SelfSupervised.py +9 -2
fengx_launch.ipynb CHANGED
@@ -33,21 +33,21 @@
33
  },
34
  {
35
  "cell_type": "code",
36
- "execution_count": 5,
37
  "metadata": {},
38
  "outputs": [
39
  {
40
  "name": "stdout",
41
  "output_type": "stream",
42
  "text": [
43
- "Enumerating objects: 9, done.\n",
44
- "Counting objects: 100% (9/9), done.\n",
45
  "Delta compression using up to 8 threads\n",
46
- "Compressing objects: 100% (5/5), done.\n",
47
- "Writing objects: 100% (5/5), 426 bytes | 426.00 KiB/s, done.\n",
48
- "Total 5 (delta 4), reused 0 (delta 0), pack-reused 0\n",
49
  "To https://huggingface.co/spaces/rjx/rjxai_image_identification\n",
50
- " adea420..4eae44a main -> main\n"
51
  ]
52
  }
53
  ],
 
33
  },
34
  {
35
  "cell_type": "code",
36
+ "execution_count": 7,
37
  "metadata": {},
38
  "outputs": [
39
  {
40
  "name": "stdout",
41
  "output_type": "stream",
42
  "text": [
43
+ "Enumerating objects: 7, done.\n",
44
+ "Counting objects: 100% (7/7), done.\n",
45
  "Delta compression using up to 8 threads\n",
46
+ "Compressing objects: 100% (4/4), done.\n",
47
+ "Writing objects: 100% (4/4), 345 bytes | 345.00 KiB/s, done.\n",
48
+ "Total 4 (delta 3), reused 0 (delta 0), pack-reused 0\n",
49
  "To https://huggingface.co/spaces/rjx/rjxai_image_identification\n",
50
+ " 276ebff..4dcf678 main -> main\n"
51
  ]
52
  }
53
  ],
fengxai/SelfSupervised.py CHANGED
@@ -2,6 +2,7 @@ import torch
2
  import supervision as sv
3
  import cv2
4
  import numpy as np
 
5
  from segment_anything import SamPredictor, sam_model_registry
6
  from diffusers import StableDiffusionInpaintPipeline
7
  from torchvision.ops import box_convert
@@ -66,10 +67,16 @@ class SelfSupervised:
66
 
67
  boxesHeight=int(xyxy[0][3]-xyxy[0][1])
68
  boxesWidth=int(xyxy[0][2]-xyxy[0][0])
69
- cv2.imwrite("data/annotated_image.jpg", imgAnnnotated)
 
 
 
 
 
 
70
 
71
  return {
72
- "imageOutput": "data/annotated_image.jpg",
73
  "imageHeight": h,
74
  "imageWidth": w,
75
  "objectHeight": boxesHeight,
 
2
  import supervision as sv
3
  import cv2
4
  import numpy as np
5
+ import os
6
  from segment_anything import SamPredictor, sam_model_registry
7
  from diffusers import StableDiffusionInpaintPipeline
8
  from torchvision.ops import box_convert
 
67
 
68
  boxesHeight=int(xyxy[0][3]-xyxy[0][1])
69
  boxesWidth=int(xyxy[0][2]-xyxy[0][0])
70
+
71
+ imageOutPutFile = "data/annotated_image.jpg"
72
+ fileList = imageOutPutFile.split("/")[0]
73
+ if not fileList:
74
+ os.mkdir(fileList)
75
+ cv2.imwrite(imageOutPutFile, imgAnnnotated)
76
+ print("os cwd=", os.getcwd())
77
 
78
  return {
79
+ "imageOutput": imageOutPutFile,
80
  "imageHeight": h,
81
  "imageWidth": w,
82
  "objectHeight": boxesHeight,