or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

authentication.mddataset-versions.mdhigh-level-utilities.mdindex.mdmodel-inference.mdproject-operations.mdworkspace-management.md

workspace-management.mddocs/

0

# Workspace Management

1

2

Comprehensive workspace operations including project listing, creation, dataset uploads, and advanced workflows like active learning and CLIP-based image comparison. Workspaces represent team or organizational containers for computer vision projects.

3

4

## Capabilities

5

6

### Workspace Class

7

8

Main interface for workspace-level operations and project management.

9

10

```python { .api }

11

class Workspace:

12

def __init__(self, info, api_key, default_workspace, model_format):

13

"""

14

Initialize workspace object.

15

16

Parameters:

17

- info: dict - Workspace information from API

18

- api_key: str - Roboflow API key

19

- default_workspace: str - Default workspace identifier

20

- model_format: str - Preferred model format

21

"""

22

23

# Properties

24

name: str # Workspace name

25

project_list: list # List of projects in workspace

26

members: list # Workspace members (if available)

27

url: str # Workspace URL

28

```

29

30

### Project Listing and Access

31

32

Functions for discovering and accessing projects within a workspace.

33

34

```python { .api }

35

def list_projects(self):

36

"""

37

List all projects in the workspace.

38

39

Returns:

40

list - Project information dictionaries

41

"""

42

43

def projects(self):

44

"""

45

Get projects list.

46

47

Returns:

48

list - List of project objects

49

"""

50

51

def project(self, project_id):

52

"""

53

Access a specific project by ID.

54

55

Parameters:

56

- project_id: str - Project identifier or name

57

58

Returns:

59

Project object for the specified project

60

"""

61

```

62

63

### Project Creation

64

65

Create new computer vision projects within the workspace.

66

67

```python { .api }

68

def create_project(self, project_name, project_type, project_license="MIT", annotation="manual"):

69

"""

70

Create a new project in the workspace.

71

72

Parameters:

73

- project_name: str - Name for the new project

74

- project_type: str - Type of project ("object-detection", "classification", etc.)

75

- project_license: str - License for the project (default: "MIT")

76

- annotation: str - Annotation method (default: "manual")

77

78

Returns:

79

Project object for the newly created project

80

"""

81

```

82

83

### Dataset Upload

84

85

Bulk dataset upload functionality with support for various formats and parallel processing.

86

87

```python { .api }

88

def upload_dataset(self, dataset_path, project_name, num_workers=10, dataset_format="NOT_USED", project_license="MIT", project_type="object-detection", batch_name=None, num_retries=0):

89

"""

90

Upload a dataset to the workspace, creating or updating a project.

91

92

Parameters:

93

- dataset_path: str - Path to dataset directory

94

- project_name: str - Name of the project to upload to

95

- num_workers: int - Number of parallel upload workers (default: 10)

96

- dataset_format: str - Deprecated parameter, kept for compatibility (default: "NOT_USED")

97

- project_license: str - License for created projects (default: "MIT")

98

- project_type: str - Type of projects to create (default: "object-detection")

99

- batch_name: str, optional - Name for the upload batch (default: None)

100

- num_retries: int - Number of retry attempts on failure (default: 0)

101

102

Returns:

103

dict - Upload results and project information

104

"""

105

```

106

107

### CLIP Image Comparison

108

109

Advanced image comparison using CLIP embeddings for similarity analysis.

110

111

```python { .api }

112

def clip_compare(self, dir="", image_ext=".png", target_image=""):

113

"""

114

Compare images using CLIP embeddings to find similar images.

115

116

Parameters:

117

- dir: str - Directory containing images to compare

118

- image_ext: str - Image file extension to process (default: ".png")

119

- target_image: str - Target image for similarity comparison

120

121

Returns:

122

list[dict] - List of image similarity results with scores

123

"""

124

```

125

126

### Two-Stage Workflows

127

128

Advanced workflows combining multiple AI models for enhanced computer vision pipelines.

129

130

```python { .api }

131

def two_stage(self, dir, image_ext, target_image, model_type, num_images=10, upload_to_project=None):

132

"""

133

Execute two-stage AI workflow combining models.

134

135

Parameters:

136

- dir: str - Directory containing images

137

- image_ext: str - Image file extension

138

- target_image: str - Target/reference image

139

- model_type: str - Type of model for second stage

140

- num_images: int - Number of images to process (default: 10)

141

- upload_to_project: str, optional - Project to upload results to

142

143

Returns:

144

dict - Two-stage processing results

145

"""

146

147

def two_stage_ocr(self, dir, image_ext, target_image, model_type, num_images=10, upload_to_project=None):

148

"""

149

Execute two-stage workflow with OCR processing.

150

151

Parameters:

152

- dir: str - Directory containing images

153

- image_ext: str - Image file extension

154

- target_image: str - Target/reference image

155

- model_type: str - Type of model for processing

156

- num_images: int - Number of images to process (default: 10)

157

- upload_to_project: str, optional - Project to upload results to

158

159

Returns:

160

dict - OCR and processing results

161

"""

162

```

163

164

### Active Learning

165

166

Automated active learning workflows for improving model performance with minimal labeling effort.

167

168

```python { .api }

169

def active_learning(self, raw_data_location, raw_data_extension=".jpg", label_assist_class=None, upload_destination=None):

170

"""

171

Execute active learning workflow to identify valuable images for labeling.

172

173

Parameters:

174

- raw_data_location: str - Directory containing unlabeled images

175

- raw_data_extension: str - Image file extension (default: ".jpg")

176

- label_assist_class: str, optional - Specific class to focus active learning on

177

- upload_destination: str, optional - Project to upload selected images to

178

179

Returns:

180

dict - Active learning results and recommendations

181

"""

182

```

183

184

### Model Deployment

185

186

Deploy trained models to production environments.

187

188

```python { .api }

189

def deploy_model(self, model_path, model_type, model_name):

190

"""

191

Deploy a trained model to production.

192

193

Parameters:

194

- model_path: str - Path to model files

195

- model_type: str - Type of model being deployed

196

- model_name: str - Name for the deployed model

197

198

Returns:

199

dict - Deployment information and endpoints

200

"""

201

```

202

203

## Usage Examples

204

205

### Basic Workspace Operations

206

207

```python

208

import roboflow

209

210

rf = roboflow.Roboflow(api_key="your_api_key")

211

workspace = rf.workspace()

212

213

# List all projects

214

projects = workspace.list_projects()

215

print(f"Found {len(projects)} projects")

216

217

# Access specific project

218

project = workspace.project("my-project-name")

219

220

# Create new project

221

new_project = workspace.create_project(

222

project_name="new-detection-project",

223

project_type="object-detection",

224

project_license="MIT"

225

)

226

```

227

228

### Dataset Upload

229

230

```python

231

# Upload a dataset directory

232

upload_result = workspace.upload_dataset(

233

dataset_path="/path/to/my/dataset",

234

project_name="my-project-name",

235

num_workers=5,

236

project_type="object-detection",

237

batch_name="My Dataset Upload"

238

)

239

```

240

241

### Advanced Workflows

242

243

```python

244

# CLIP image comparison

245

similar_images = workspace.clip_compare(

246

dir="/path/to/images",

247

image_ext=".jpg",

248

target_image="/path/to/target.jpg"

249

)

250

251

# Active learning workflow

252

learning_results = workspace.active_learning(

253

raw_data_location="/path/to/unlabeled/images",

254

raw_data_extension=".png",

255

label_assist_class="person",

256

upload_destination="my-project"

257

)

258

```

259

260

## Configuration

261

262

Workspace behavior can be configured through:

263

264

- **API Key**: Required for authentication and access control

265

- **Model Format**: Default format for downloads and processing

266

- **Upload Settings**: Batch names, retry policies, worker counts

267

- **Active Learning**: Class focus, similarity thresholds

268

269

## Error Handling

270

271

Workspace operations can raise various exceptions:

272

273

```python

274

from roboflow.adapters.rfapi import RoboflowError, ImageUploadError

275

276

try:

277

workspace.upload_dataset("/invalid/path")

278

except ImageUploadError as e:

279

print(f"Upload failed: {e}")

280

except RoboflowError as e:

281

print(f"API error: {e}")

282

```